Created
April 4, 2014 10:40
-
-
Save ErDmKo/9972069 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Django settings for surgut project. | |
For more information on this file, see | |
https://docs.djangoproject.com/en/1.6/topics/settings/ | |
For the full list of settings and their values, see | |
https://docs.djangoproject.com/en/1.6/ref/settings/ | |
""" | |
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) | |
import logging | |
import os | |
BASE_DIR = os.path.dirname(os.path.dirname(__file__)) | |
PROJECT_NAME = os.path.basename(BASE_DIR) | |
# Quick-start development settings - unsuitable for production | |
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/ | |
# SECURITY WARNING: keep the secret key used in production secret! | |
SECRET_KEY = 'ulmz#wiw1pkwjk=3w_8-$=el^ejc!zu!hx4bn_+!_oee9c(mos' | |
# SECURITY WARNING: don't run with debug turned on in production! | |
TEMPLATE_CONTEXT_PROCESSORS = ( | |
'django.core.context_processors.static', | |
'django.core.context_processors.request', | |
'django.contrib.auth.context_processors.auth', | |
'django.contrib.messages.context_processors.messages', | |
) | |
ALLOWED_HOSTS = [] | |
# Application definition | |
INSTALLED_APPS = ( | |
'django.contrib.admin', | |
'django.contrib.auth', | |
'django.contrib.contenttypes', | |
'django.contrib.sessions', | |
'django.contrib.messages', | |
'django.contrib.staticfiles', | |
) | |
MIDDLEWARE_CLASSES = ( | |
'django.contrib.sessions.middleware.SessionMiddleware', | |
'django.middleware.common.CommonMiddleware', | |
'django.middleware.csrf.CsrfViewMiddleware', | |
'django.contrib.auth.middleware.AuthenticationMiddleware', | |
'django.contrib.messages.middleware.MessageMiddleware', | |
'django.middleware.clickjacking.XFrameOptionsMiddleware', | |
) | |
# Database | |
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.sqlite3', | |
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), | |
} | |
} | |
ENVIRONMENT_NAME = "core" | |
CACHES = { | |
'default': { | |
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', | |
'KEY_PREFIX': '_'.join((PROJECT_NAME, ENVIRONMENT_NAME)) | |
} | |
} | |
# Internationalization | |
# https://docs.djangoproject.com/en/1.6/topics/i18n/ | |
USE_I18N = True | |
USE_L10N = True | |
USE_TZ = True | |
# Static files (CSS, JavaScript, Images) | |
# https://docs.djangoproject.com/en/1.6/howto/static-files/ | |
STATIC_URL = '/static/' | |
MEDIA_URL = '/media/' | |
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': False, | |
'formatters': { | |
'verbose': { | |
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s' # noqa | |
}, | |
'simple': { | |
'format': '%(levelname)s %(message)s' | |
}, | |
}, | |
'filters': { | |
'require_debug_false': { | |
'()': 'django.utils.log.RequireDebugFalse' | |
} | |
}, | |
'handlers': { | |
'mail_admins': { | |
'level': 'ERROR', | |
'filters': ['require_debug_false'], | |
'class': 'django.utils.log.AdminEmailHandler' | |
}, | |
'console': { | |
'level': 'DEBUG', | |
'class': 'logging.StreamHandler', | |
'formatter': 'simple' | |
} | |
}, | |
'loggers': { | |
'django.request': { | |
'handlers': ['mail_admins'], | |
'level': 'ERROR', | |
'propagate': True, | |
}, | |
'django': { | |
'handlers': ['console'], | |
'level': 'INFO', | |
'propagate': True, | |
}, | |
'joltem': { | |
'handlers': ['console'], | |
'level': 'DEBUG', | |
'propagate': True, | |
}, | |
'tests': { | |
'handlers': ['console'], | |
'level': 'DEBUG', | |
'propagate': True, | |
} | |
} | |
} | |
logging.basicConfig( | |
level=logging.DEBUG, | |
format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', | |
datefmt='%d.%m %H:%M:%S', | |
) | |
logging.info("Core settings loaded.") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from .production import * | |
DEBUG = True | |
TEMPLATE_DEBUG = DEBUG | |
TEMPLATE_CONTEXT_PROCESSORS += 'django.core.context_processors.debug', | |
MIDDLEWARE_CLASSES += 'debug_toolbar.middleware.DebugToolbarMiddleware', | |
INSTALLED_APPS += 'debug_toolbar', 'django_extensions' | |
DEBUG_TOOLBAR_PATCH_SETTINGS = False | |
ENVIRONMENT_NAME = "dev" | |
LOGGING['loggers']['django.request']['level'] = 'WARNING' | |
LOGGING['loggers']['django.db.backends'] = { | |
'handlers': ['console'], | |
'level': 'WARNING' | |
} | |
# Caches | |
CACHES['default']['KEY_PREFIX'] = '_'.join((PROJECT_NAME, ENVIRONMENT_NAME)) | |
# Let cookie to be sent via http | |
SESSION_COOKIE_SECURE = False | |
CSRF_COOKIE_SECURE = False | |
logging.info('Develop settings are loaded.') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from .develop import * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from .core import * | |
ADMINS = ('ErDmKo', '[email protected]'), | |
MANAGERS = ADMINS | |
ROOT_URLCONF = 'surgut.urls' | |
ENVIRONMENT_NAME = 'core' | |
TIME_ZONE = 'Europe/Moscow' | |
LANGUAGE_CODE = 'ru-RU' | |
TEMPLATE_CONTEXT_PROCESSORS += ('django.core.context_processors.i18n',) | |
WSGI_APPLICATION = 'surgut.wsgi.application' | |
STATICFILES_DIRS = os.path.join(BASE_DIR, 'assets'), | |
MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), '../media') | |
STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), '../static') | |
INSTALLED_APPS += 'context', | |
TEMPLATE_CONTEXT_PROCESSORS += 'context.proc.extra_var', | |
logging.info('Prod settings are loaded.') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment