Skip to content

Commit 7de25e0

Browse files
committed
chore: Cache Python dependencies during CI and add default config values
1 parent 8effcaa commit 7de25e0

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

Diff for: .github/workflows/forum.yml

+10
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ jobs:
2121
with:
2222
python-version: ${{ matrix.python-version }}
2323

24+
- name: Cache Python dependencies
25+
uses: actions/cache@v3
26+
with:
27+
path: |
28+
~/.cache/pip
29+
!~/.cache/pip/log
30+
key: ${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}
31+
restore-keys: |
32+
${{ runner.os }}-py${{ matrix.python-version }}-
33+
2434
- name: Install Dependencies
2535
run: |
2636
python -m pip install --upgrade pip

Diff for: config/settings/base.py

+10-11
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ def rel(*path):
2626
# SECURITY WARNING: don't run with debug turned on in production!
2727
DEBUG = config("DEBUG", default=True, cast=bool)
2828

29-
ALLOWED_HOSTS = config("ALLOWED_HOSTS", cast=Csv())
30-
29+
ALLOWED_HOSTS = config("ALLOWED_HOSTS", default=[], cast=Csv())
3130

3231
# Application definition
3332

@@ -102,12 +101,12 @@ def rel(*path):
102101

103102
DATABASES = {
104103
"default": {
105-
"ENGINE": config("DB_ENGINE"),
106-
"NAME": config("DB_NAME"),
107-
"USER": config("DB_USERNAME"),
108-
"PASSWORD": config("DB_PASSWORD"),
109-
"HOST": config("DB_HOSTNAME"),
110-
"PORT": config("DB_PORT", cast=int),
104+
"ENGINE": config("DB_ENGINE", default="django.db.backends.postgresql"),
105+
"NAME": config("DB_NAME", default="forum"),
106+
"USER": config("DB_USERNAME", default="forum"),
107+
"PASSWORD": config("DB_PASSWORD", default="forum"),
108+
"HOST": config("DB_HOSTNAME", default="127.0.0.1"),
109+
"PORT": config("DB_PORT", default=5432, cast=int),
111110
}
112111
}
113112

@@ -192,7 +191,7 @@ def rel(*path):
192191

193192
SITE_ID = 1
194193

195-
CSRF_TRUSTED_ORIGINS = config("CSRF_TRUSTED_ORIGINS", cast=Csv())
194+
CSRF_TRUSTED_ORIGINS = config("CSRF_TRUSTED_ORIGINS", default=[], cast=Csv())
196195

197196
# Email
198197
EMAIL_BACKEND = config("DJANGO_EMAIL_BACKEND", default="django.core.mail.backends.console.EmailBackend")
@@ -237,8 +236,8 @@ def rel(*path):
237236
# -------------------------------------------------------------------------------
238237
# simple-jwt - https://django-rest-framework-simplejwt.readthedocs.io/en/latest/settings.html
239238
SIMPLE_JWT = {
240-
"ACCESS_TOKEN_LIFETIME": timedelta(minutes=config("ACCESS_TOKEN_LIFETIME", cast=int)),
241-
"REFRESH_TOKEN_LIFETIME": timedelta(days=config("REFRESH_TOKEN_LIFETIME", cast=int)),
239+
"ACCESS_TOKEN_LIFETIME": timedelta(minutes=config("ACCESS_TOKEN_LIFETIME", default=30, cast=int)),
240+
"REFRESH_TOKEN_LIFETIME": timedelta(days=config("REFRESH_TOKEN_LIFETIME", default=15, cast=int)),
242241
}
243242

244243
# drf-spectacular

0 commit comments

Comments
 (0)