settings: remove settings folder and replace it by a settings.py file

Closes #4151
This commit is contained in:
Jérôme Schneider 2013-12-18 10:18:13 +01:00
parent 3396c6cb3f
commit 854feaf6f5
7 changed files with 18 additions and 45 deletions

View File

@ -5,7 +5,7 @@
import os
from logging.handlers import SysLogHandler
from ..settings import PROJECT_PATH
PROJECT_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'calebasse')
DEBUG = True
TEMPLATE_DEBUG = True
@ -49,7 +49,7 @@ USE_I18N = True
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True
FORMAT_MODULE_PATH = 'calebasse.settings.formats'
FORMAT_MODULE_PATH = 'calebasse.formats'
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = False
@ -260,9 +260,7 @@ LOGIN_REDIRECT_URL = '/'
# Sentry / raven configuration
# You need to overload this option in the local_settings.py
RAVEN_CONFIG = {
'dsn': None,
}
RAVEN_CONFIG = {}
# Base directory for generated patient files
PATIENT_FILES_BASE_DIRECTORY = None
@ -335,3 +333,18 @@ INVOICING_DIRECTORY = None
# # delay between two mails, in seconds, or None
# 'smtp_delay': None,
# }
try:
from local_settings import *
except ImportError:
print """
-------------------------------------------------------------------------
You need to create a local_settings.py file which needs to contain at least
database connection information.
Copy local_settings_example.py to local_settings.py and edit it.
-------------------------------------------------------------------------
"""
import sys
sys.exit(1)

View File

@ -1,40 +0,0 @@
import os.path
PROJECT_PATH = os.path.dirname(os.path.dirname(__file__))
from common import *
from calebasse import *
#########################################################################
# Import settings from local_settings.py, if it exists.
#
# Put this at the end of settings.py
try:
import local_settings
except ImportError:
print """
-------------------------------------------------------------------------
You need to create a local_settings.py file which needs to contain at least
database connection information.
Copy local_settings_example.py to local_settings.py and edit it.
-------------------------------------------------------------------------
"""
import sys
sys.exit(1)
else:
# Import any symbols that begin with A-Z. Append to lists any symbols that
# begin with "EXTRA_".
import re
for attr in dir(local_settings):
match = re.search('^EXTRA_(\w+)', attr)
if match:
name = match.group(1)
value = getattr(local_settings, attr)
try:
globals()[name] += value
except KeyError:
globals()[name] = value
elif re.search('^[A-Z]', attr):
globals()[attr] = getattr(local_settings, attr)