django-fobi/examples/simple/settings/test.py

125 lines
3.2 KiB
Python
Raw Normal View History

2016-10-31 01:14:28 +00:00
# Use in `tox`.
from django_nine import versions
2016-10-31 01:14:28 +00:00
from .base import *
2016-10-31 01:14:28 +00:00
TESTING = True
2016-10-31 01:14:28 +00:00
INSTALLED_APPS = list(INSTALLED_APPS)
2016-10-31 01:14:28 +00:00
2017-12-27 14:11:05 +00:00
if versions.DJANGO_1_8:
2016-10-31 01:14:28 +00:00
try:
2017-12-27 14:11:05 +00:00
INSTALLED_APPS.remove('tinymce') \
if 'tinymce' in INSTALLED_APPS \
else None
except Exception as err:
2016-10-31 01:14:28 +00:00
pass
try:
INSTALLED_APPS.remove('admin_tools') \
if 'admin_tools' in INSTALLED_APPS else None
INSTALLED_APPS.remove('admin_tools.menu') \
if 'admin_tools.menu' in INSTALLED_APPS else None
INSTALLED_APPS.remove('admin_tools.dashboard') \
if 'admin_tools.dashboard' in INSTALLED_APPS else None
except Exception as err:
2016-10-31 01:14:28 +00:00
pass
elif versions.DJANGO_1_9:
try:
2017-12-27 14:11:05 +00:00
INSTALLED_APPS.remove('tinymce') \
if 'tinymce' in INSTALLED_APPS \
else None
except Exception as err:
2016-10-31 01:14:28 +00:00
pass
try:
INSTALLED_APPS.remove('admin_tools') \
if 'admin_tools' in INSTALLED_APPS else None
INSTALLED_APPS.remove('admin_tools.menu') \
if 'admin_tools.menu' in INSTALLED_APPS else None
INSTALLED_APPS.remove('admin_tools.dashboard') \
if 'admin_tools.dashboard' in INSTALLED_APPS else None
except Exception as err:
2016-10-31 01:14:28 +00:00
pass
elif versions.DJANGO_1_10:
try:
2017-12-27 14:11:05 +00:00
INSTALLED_APPS.remove('tinymce') \
if 'tinymce' in INSTALLED_APPS \
else None
except Exception as err:
2016-10-31 01:14:28 +00:00
pass
try:
INSTALLED_APPS.remove('admin_tools') \
if 'admin_tools' in INSTALLED_APPS else None
INSTALLED_APPS.remove('admin_tools.menu') \
if 'admin_tools.menu' in INSTALLED_APPS else None
INSTALLED_APPS.remove('admin_tools.dashboard') \
if 'admin_tools.dashboard' in INSTALLED_APPS else None
except Exception as err:
2016-10-31 01:14:28 +00:00
pass
LOGGING = {}
2016-11-10 01:35:53 +00:00
DEBUG_TOOLBAR = False
2017-12-17 22:12:42 +00:00
DATABASES = {
'default': {
# Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
2018-08-12 00:32:38 +00:00
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'fobi',
'USER': 'postgres',
'PASSWORD': 'test',
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': PROJECT_DIR('../../db/example.db'),
# 'USER': '',
# 'PASSWORD': '',
2017-12-17 22:12:42 +00:00
# Empty for localhost through domain sockets or '127.0.0.1' for
# localhost through TCP.
'HOST': '',
# Set to empty string for default.
'PORT': '',
2019-05-21 19:59:45 +00:00
'TEST': {
'NAME': 'fobi_tests',
'USER': 'postgres',
'PASSWORD': '', # For travis
}
2017-12-17 22:12:42 +00:00
}
}
2017-12-27 14:11:05 +00:00
2018-08-12 00:42:42 +00:00
# Conditionally choosing the right postgres engine
2018-09-13 20:17:35 +00:00
if versions.DJANGO_GTE_1_11:
2018-08-12 00:42:42 +00:00
DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql'
else:
DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2'
2017-12-27 14:11:05 +00:00
# FeinCMS addons
INSTALLED_APPS += [
'feincms', # FeinCMS
'fobi.contrib.apps.feincms_integration', # Fobi FeinCMS app
'page', # Example
'tinymce', # TinyMCE
]
2017-12-27 19:44:17 +00:00
MIGRATION_MODULES = {
'fobi': 'fobi.migrations',
'db_store': 'fobi.contrib.plugins.form_handlers.db_store.migrations',
'page': 'page.migrations',
}
2018-08-12 00:42:42 +00:00
try:
from .loca_settings import TEST_DATABASES as DATABASES
except:
pass