Refactor: split code into several django apps (we call them modules).
This commit is contained in:
@@ -0,0 +1,145 @@
|
||||
|
||||
#
|
||||
# Additional settings for django-dav
|
||||
#
|
||||
|
||||
BASE_VAR_DIR = os.path.join(BASE_DIR, 'var')
|
||||
BASE_SHARE_DIR = os.path.join(BASE_DIR, 'common')
|
||||
|
||||
# Get modules config
|
||||
from dav_base.config.modules import ModuleConfig
|
||||
MODULE_CONFIG = ModuleConfig()
|
||||
|
||||
INSTALLED_APPS += [
|
||||
'bootstrap3',
|
||||
'datetimewidget',
|
||||
'django_countries',
|
||||
'django_extensions',
|
||||
# Our main app
|
||||
'dav_base',
|
||||
]
|
||||
|
||||
# Add apps from our modules
|
||||
for module_meta_obj in MODULE_CONFIG.modules.values():
|
||||
if module_meta_obj.app:
|
||||
INSTALLED_APPS.append(module_meta_obj.app)
|
||||
if module_meta_obj.additional_apps:
|
||||
for app in module_meta_obj.additional_apps:
|
||||
INSTALLED_APPS.append(app)
|
||||
|
||||
# Add a template engine without html auto escape for rendering plain text templates.
|
||||
TEMPLATES += [
|
||||
{
|
||||
'NAME': 'PLAINTEXT',
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'autoescape': False,
|
||||
'context_processors': [
|
||||
'django.template.context_processors.debug',
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
# Add our local templates directory to the template engine configurations.
|
||||
for config in TEMPLATES:
|
||||
config['DIRS'].append(os.path.join(BASE_SHARE_DIR, 'templates'))
|
||||
|
||||
DATABASES['default'] = {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': os.path.join(BASE_VAR_DIR, 'db', 'devel.sqlite3'),
|
||||
}
|
||||
|
||||
STATIC_ROOT = os.path.join(BASE_VAR_DIR, 'www', 'static')
|
||||
|
||||
LANGUAGE_CODE = 'de'
|
||||
|
||||
LOGIN_URL = 'dav_auth:login'
|
||||
|
||||
BOOTSTRAP3 = {
|
||||
'set_placeholder': False,
|
||||
}
|
||||
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'formatters': {
|
||||
'default': {
|
||||
'format': '%(asctime)s - %(name)s - %(levelname)s: %(message)s'
|
||||
},
|
||||
'verbose': {
|
||||
'format': ('%(asctime)s -- %(processName)s[%(process)d]:%(threadName)s[%(thread)d] -- '
|
||||
'%(name)s -- %(module)s...%(funcName)s() -- %(pathname)s:%(lineno)d -- '
|
||||
'%(levelname)s: %(message)s')
|
||||
},
|
||||
},
|
||||
'filters': {
|
||||
'require_debug_true': {
|
||||
'()': 'django.utils.log.RequireDebugTrue',
|
||||
},
|
||||
'require_debug_false': {
|
||||
'()': 'django.utils.log.RequireDebugFalse',
|
||||
},
|
||||
},
|
||||
'handlers': {
|
||||
'null': {
|
||||
'class': 'logging.NullHandler',
|
||||
},
|
||||
'console': {
|
||||
'level': 'DEBUG',
|
||||
'filters': ['require_debug_true'],
|
||||
'class': 'logging.StreamHandler',
|
||||
},
|
||||
'console_error': {
|
||||
'level': 'ERROR',
|
||||
'filters': ['require_debug_false'],
|
||||
'class': 'logging.StreamHandler',
|
||||
},
|
||||
'mail_admins': {
|
||||
'level': 'ERROR',
|
||||
'filters': ['require_debug_false'],
|
||||
'class': 'django.utils.log.AdminEmailHandler'
|
||||
},
|
||||
'default_log': {
|
||||
'level': 'INFO',
|
||||
'class': 'logging.FileHandler',
|
||||
'filename': os.path.join(BASE_VAR_DIR, 'log', 'default.log'),
|
||||
'formatter': 'default',
|
||||
},
|
||||
'error_log': {
|
||||
'level': 'ERROR',
|
||||
'class': 'logging.FileHandler',
|
||||
'filename': os.path.join(BASE_VAR_DIR, 'log', 'error.log'),
|
||||
'formatter': 'default',
|
||||
},
|
||||
'debug_log': {
|
||||
'level': 'DEBUG',
|
||||
'filters': ['require_debug_true'],
|
||||
'class': 'logging.FileHandler',
|
||||
'filename': os.path.join(BASE_VAR_DIR, 'log', 'debug.log'),
|
||||
'formatter': 'verbose',
|
||||
},
|
||||
},
|
||||
'loggers': {
|
||||
'django': {
|
||||
'level': 'INFO',
|
||||
'propagate': True,
|
||||
},
|
||||
'django.request': {
|
||||
'level': 'DEBUG',
|
||||
'handlers': ['mail_admins'],
|
||||
'propagate': True,
|
||||
},
|
||||
'django.security': {
|
||||
'level': 'DEBUG',
|
||||
'handlers': ['mail_admins'],
|
||||
'propagate': True,
|
||||
},
|
||||
},
|
||||
'root': {
|
||||
'level': 'DEBUG',
|
||||
'handlers': ['console', 'console_error', 'default_log', 'error_log', 'debug_log'],
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# E-Mails
|
||||
EMAIL_SENDER = 'DAV heinzel <heinzel@alpenverein-karlsruhe.de>'
|
||||
EMAIL_BASE_URL = 'http://localhost:8000'
|
||||
EMAIL_SUBJECT_PREFIX = u'[DAV heinzel]'
|
||||
12
dav_base/console_scripts/django_project_config/urls.py
Normal file
12
dav_base/console_scripts/django_project_config/urls.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from django.conf import settings
|
||||
from django.conf.urls import url, include
|
||||
|
||||
urlpatterns = []
|
||||
|
||||
for module_meta_obj in settings.MODULE_CONFIG.modules.values():
|
||||
if module_meta_obj.url_conf_pattern:
|
||||
urlpatterns.append(module_meta_obj.url_conf_pattern)
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^', include('dav_base.urls'))
|
||||
]
|
||||
Reference in New Issue
Block a user