Skip to content

Commit

Permalink
clean up settings import
Browse files Browse the repository at this point in the history
  • Loading branch information
coffindragger committed Sep 23, 2011
1 parent a175c7c commit f036e0e
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 99 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,6 @@ CACHES = {
}
}


LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}


def setup(settings):
"""
This function is called before the final settings are passed to
Expand Down
95 changes: 90 additions & 5 deletions djenesis/project_templates/default/apps/mainsite/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,96 @@
if APPS_DIR not in sys.path:
sys.path.insert(0, APPS_DIR)

from mainsite import import_settings
from mainsite import TOP_DIR

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',

settings_dict = globals()
# import settings from settings_project and add them to globals
settings_dict.update(import_settings('mainsite.settings_project'))
'mainsite',
)

settings_dict.update(import_settings('mainsite.settings_local'))

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)

TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.static',
'django.core.context_processors.request',
'django.contrib.messages.context_processors.messages',
)


TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)


STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)


MEDIA_ROOT = os.path.join(TOP_DIR, 'media')
MEDIA_URL = '/media/'

STATIC_ROOT = os.path.join(TOP_DIR, 'static')
STATIC_URL = '/static/'

ADMIN_MEDIA_PREFIX = '/static/admin/'

ROOT_URLCONF = 'mainsite.urls'

TEMPLATE_DIRS = (
os.path.join(TOP_DIR, 'templates'),
)

SITE_ID = 1

USE_I18N = True
USE_L10N = True



LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}




# try to import local_settings if present
try:
from local_settings import *
except ImportError as e:
pass

This file was deleted.

4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
packages=['djenesis'],
package_data={'djenesis': [
'project_templates/default/.gitignore',
'project_templates/default/manage.py',
'project_templates/default/apps/mainsite/*',
'project_templates/default/templates/*',
'project_templates/default/requirements.txt',
'project_templates/default/media/css/.gitignore',
'project_templates/default/media/img/.gitignore',
'project_templates/default/media/js/.gitignore',
'project_templates/default/media/uploads/.gitignore',
'project_templates/default/fixtures/.gitignore',
'project_templates/default/templates/*',
]},
)

0 comments on commit f036e0e

Please sign in to comment.