Skip to content

Commit c3f39be

Browse files
committed
[settings] Moved settings to the root dir again. Avoid common setting.py name
1 parent 10a64f9 commit c3f39be

7 files changed

+28
-22
lines changed

.travis.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,34 @@ matrix:
2121
- python: 2.7
2222
env:
2323
- DJANGO=1.11
24+
- DATABASE=sqlite
2425
- python: 2.7
2526
env:
2627
- DJANGO=1.11
27-
- DATABASE=_postgres
28+
- DATABASE=postgres
2829
# https://docs.djangoproject.com/en/2.2/ref/contrib/gis/install/
2930
- python: 3.6
3031
env:
3132
- DJANGO=2.2
33+
- DATABASE=sqlite
3234
- python: 3.6
3335
env:
3436
- DJANGO=2.2
35-
- DATABASE=_postgres
37+
- DATABASE=postgres
3638
# https://docs.djangoproject.com/en/3.0/ref/contrib/gis/install/
3739
# https://docs.djangoproject.com/en/3.0/releases/3.0/#id2
3840
- python: 3.7
3941
env:
4042
- DJANGO=3.0
43+
- DATABASE=sqlite
4144
- python: 3.8
4245
env:
4346
- DJANGO=3.0
47+
- DATABASE=sqlite
4448
- python: 3.8
4549
env:
4650
- DJANGO=3.0
47-
- DATABASE=_postgres
51+
- DATABASE=postgres
4852

4953
before_script:
5054
- export PYTHONPATH=$PYTHONPATH:$(pwd)
@@ -69,7 +73,7 @@ install:
6973
- pip install Django~=${DJANGO}.0
7074

7175
script:
72-
- pytest --create-db --reuse-db --no-migrations --ds=ddf_settings.settings${DATABASE}
76+
- pytest --create-db --reuse-db --no-migrations --ds=settings_${DATABASE}
7377

7478
after_success:
7579
- coveralls

manage.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env python
22
try:
3-
import ddf_settings.settings # Assumed to be in the same directory.
3+
import settings_sqlite # Assumed to be in the same directory.
44
except ImportError:
55
import sys
66
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
77
sys.exit(1)
88

99
if __name__ == "__main__":
1010
import os
11-
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ddf_settings.settings")
11+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings_sqlite")
1212
from django.core.management import execute_from_command_line
1313
execute_from_command_line()

pytest.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[pytest]
2-
DJANGO_SETTINGS_MODULE = ddf_settings.settings
2+
DJANGO_SETTINGS_MODULE = settings_sqlite
33
addopts = --pyargs --create-db --reuse-db --no-migrations
44
python_files = test_*.py

ddf_settings/settings.py renamed to settings_ddf.py

-13
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,6 @@
66

77
IMPORT_DDF_MODELS = True
88

9-
DDF_TEST_GEODJANGO = False
10-
11-
# SQlite and SpatialLite
12-
# brew install spatialite-tools
13-
# brew install gdal
14-
SPATIALITE_LIBRARY_PATH = '/usr/local/lib/mod_spatialite.dylib'
15-
DATABASES = {
16-
'default': {
17-
'ENGINE': 'django.db.backends.sqlite3',
18-
'NAME': ':memory:',
19-
}
20-
}
21-
229
SECRET_KEY = 'ddf-secret-key'
2310

2411
ALLOWED_HOSTS = ['*'] # Since Django 1.11, it is verified when running tests

ddf_settings/settings_mysql.py renamed to settings_mysql.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from settings import *
1+
from settings_ddf import *
22

33
DDF_TEST_GEODJANGO = True
44

ddf_settings/settings_postgres.py renamed to settings_postgres.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from settings import *
1+
from settings_ddf import *
22

33
DDF_TEST_GEODJANGO = True
44

settings_sqlite.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from settings_ddf import *
2+
3+
DDF_TEST_GEODJANGO = False
4+
5+
# SQlite and SpatialLite
6+
# brew install spatialite-tools
7+
# brew install gdal
8+
SPATIALITE_LIBRARY_PATH = '/usr/local/lib/mod_spatialite.dylib'
9+
DATABASES = {
10+
'default': {
11+
'ENGINE': 'django.db.backends.sqlite3',
12+
'NAME': ':memory:',
13+
}
14+
}
15+

0 commit comments

Comments
 (0)