Skip to content

Commit

Permalink
modified few areas
Browse files Browse the repository at this point in the history
  • Loading branch information
goutomroy committed Oct 17, 2023
1 parent 1a4c00e commit 9f91244
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 4 deletions.
1 change: 1 addition & 0 deletions .envs/.env.dev
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# web
DJANGO_SETTINGS_MODULE=hex_images.settings.development
SECRET_KEY=django-insecure-@0*hp*@)v1qpq2j&!s3+2gw7!f=kh0h$9tf_e0w4prq&=q860h

# postgres
POSTGRES_DB=hex_images
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Django CI

on:
push:
branches: [ "master", "develop", "feature/*" ]
pull_request:
branches: [ "master",]

jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.11, ]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Tests
run: |
python manage.py test
2 changes: 1 addition & 1 deletion apps/photos/views/expiring_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_queryset(self):
return (
super()
.get_queryset()
.prefetch_related("image__user")
.select_related("image__user")
.filter(
image__user=self.request.user,
expired_at__gt=timezone.now(),
Expand Down
2 changes: 1 addition & 1 deletion apps/photos/views/expiring_link_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def get_queryset(self):
return (
super()
.get_queryset()
.prefetch_related("image__user")
.select_related("image__user")
.filter(
image__user=self.request.user,
expired_at__gt=timezone.now(),
Expand Down
9 changes: 8 additions & 1 deletion hex_images/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "django-insecure-@0*hp*@)v1qpq2j&!s3+2gw7!f=kh0h$9tf_e0w4prq&=q860h"
SECRET_KEY = os.environ.get("SECRET_KEY")

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
Expand Down Expand Up @@ -97,6 +97,13 @@
}
}

# Cache
CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.redis.RedisCache",
"LOCATION": "redis://redis:6379/0",
}
}

# Password validation
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
Expand Down
2 changes: 1 addition & 1 deletion hex_images/settings/development.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.redis.RedisCache",
"LOCATION": "redis://redis:6379/0",
"LOCATION": "redis://localhost:6379/0",
}
}

Expand Down

0 comments on commit 9f91244

Please sign in to comment.