From 0a5ae57ecd5a91d1203913ce27f43128bfc3d382 Mon Sep 17 00:00:00 2001 From: Sergei Pikhovkin Date: Tue, 19 Sep 2023 23:07:55 +0300 Subject: [PATCH] Split the settings: base and demo --- .github/workflows/build.yaml | 2 ++ .../{settings.py => settings/__init__.py} | 10 ++-------- tests/conf/settings/demo.py | 20 +++++++++++++++++++ 3 files changed, 24 insertions(+), 8 deletions(-) rename tests/conf/{settings.py => settings/__init__.py} (91%) create mode 100644 tests/conf/settings/demo.py diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 99ec930..a345157 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -71,6 +71,8 @@ jobs: if: github.event_name == 'release' && github.event.action == 'created' needs: [test] runs-on: ubuntu-latest + env: + DJANGO_SETTINGS_MODULE: tests.conf.settings.demo steps: - uses: actions/checkout@v3 - name: Docker login diff --git a/tests/conf/settings.py b/tests/conf/settings/__init__.py similarity index 91% rename from tests/conf/settings.py rename to tests/conf/settings/__init__.py index 92c99b8..7de9609 100644 --- a/tests/conf/settings.py +++ b/tests/conf/settings/__init__.py @@ -64,16 +64,10 @@ # Database # https://docs.djangoproject.com/en/4.2/ref/settings/#databases -DB_DIR = BASE_DIR.parent / 'data' / 'db' -DB_DIR.mkdir(parents=False, exist_ok=True) DATABASES = { - # 'default': { - # 'ENGINE': 'django.db.backends.sqlite3', - # 'NAME': ':memory:', - # }, 'default': { 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': DB_DIR / 'db.sqlite3', + 'NAME': ':memory:', }, } @@ -112,7 +106,7 @@ # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/4.2/howto/static-files/ -STATIC_ROOT = BASE_DIR.parent / 'data' / 'static' +STATIC_ROOT = BASE_DIR / 'static' STATIC_URL = '/static/' # Default primary key field type diff --git a/tests/conf/settings/demo.py b/tests/conf/settings/demo.py new file mode 100644 index 0000000..9b1cf53 --- /dev/null +++ b/tests/conf/settings/demo.py @@ -0,0 +1,20 @@ +from . import * + + +# Database +# https://docs.djangoproject.com/en/4.2/ref/settings/#databases + +DB_DIR = BASE_DIR.parent / 'data' / 'db' +DB_DIR.mkdir(parents=False, exist_ok=True) +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': DB_DIR / 'db.sqlite3', + }, +} + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/4.2/howto/static-files/ + +STATIC_ROOT = BASE_DIR.parent / 'data' / 'static' +STATIC_URL = '/static/'