|
1 | | -""" |
2 | | -Django settings for django_test_app project. |
3 | | -
|
4 | | -Generated by 'django-admin startproject' using Django 2.2.7. |
5 | | -
|
6 | | -For more information on this file, see |
7 | | -https://docs.djangoproject.com/en/2.2/topics/settings/ |
8 | | -
|
9 | | -For the full list of settings and their values, see |
10 | | -https://docs.djangoproject.com/en/2.2/ref/settings/ |
11 | | -""" |
| 1 | +"""Django settings for django_test_app project.""" |
12 | 2 |
|
13 | 3 | import os |
| 4 | +from pathlib import Path |
14 | 5 |
|
15 | 6 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) |
16 | | -BASE_DIR = os.path.dirname( |
17 | | - os.path.dirname(os.path.abspath(__file__)), |
18 | | -) |
| 7 | +BASE_DIR = Path(__file__).parent.parent |
19 | 8 |
|
20 | 9 |
|
21 | 10 | # Quick-start development settings - unsuitable for production |
22 | 11 | # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ |
23 | 12 |
|
24 | 13 | # SECURITY WARNING: keep the secret key used in production secret! |
25 | | -SECRET_KEY = '_dpvr*#hjgv)6v=potf%*+$na7_ck(*+^g08lw0^44zoo88)wb' |
| 14 | +SECRET_KEY = '_dpvr*#hjgv)6v=potf%*+$na7_ck(*+^g08lw0^44zoo88)wb' # noqa: S105 |
26 | 15 |
|
27 | 16 | # SECURITY WARNING: don't run with debug turned on in production! |
28 | 17 | DEBUG = True |
|
39 | 28 | 'django.contrib.sessions', |
40 | 29 | 'django.contrib.messages', |
41 | 30 | 'django.contrib.staticfiles', |
42 | | - |
43 | 31 | # Our custom checks: |
44 | 32 | 'django_test_migrations.contrib.django_checks.AutoNames', |
45 | 33 | 'django_test_migrations.contrib.django_checks.DatabaseConfiguration', |
46 | | - |
47 | 34 | # Custom: |
48 | 35 | 'main_app', |
49 | 36 | ] |
|
84 | 71 |
|
85 | 72 | _DATABASE_NAME = os.environ.get( |
86 | 73 | 'DJANGO_DATABASE_NAME', |
87 | | - default=os.path.join(BASE_DIR, 'db.sqlite3'), |
| 74 | + default=BASE_DIR.joinpath('db.sqlite3'), |
88 | 75 | ) |
89 | 76 | DATABASES = { |
90 | 77 | 'default': { |
|
101 | 88 | 'NAME': ( |
102 | 89 | _DATABASE_NAME |
103 | 90 | if _DATABASE_NAME.startswith('test_') |
104 | | - else 'test_{0}'.format(_DATABASE_NAME) |
| 91 | + else f'test_{_DATABASE_NAME}' |
105 | 92 | ), |
106 | 93 | }, |
107 | 94 | }, |
|
0 commit comments