Add codetemplates directory; add Django project template
This commit is contained in:
parent
2ea4c34811
commit
23996c860b
11 changed files with 180 additions and 0 deletions
111
codetemplates/django_project/settings.py
Normal file
111
codetemplates/django_project/settings.py
Normal file
|
@ -0,0 +1,111 @@
|
|||
# Settings for {{ project_name }}.
|
||||
|
||||
import os
|
||||
|
||||
PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
DEBUG = os.environ.get('DEBUG', False)
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
ADMINS = ()
|
||||
MANAGERS = ADMINS
|
||||
|
||||
import dj_database_url
|
||||
DATABASES = {'default': dj_database_url.config()}
|
||||
|
||||
SITE_ID = 1
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
USE_I18N = True
|
||||
USE_L10N = True
|
||||
|
||||
USE_TZ = True
|
||||
TIME_ZONE = 'America/Los_Angeles'
|
||||
|
||||
MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media')
|
||||
MEDIA_URL = '/media/'
|
||||
|
||||
STATIC_ROOT = os.path.join(PROJECT_DIR, 'collected-static')
|
||||
STATIC_URL = '/static/'
|
||||
|
||||
STATICFILES_DIRS = (
|
||||
os.path.join(PROJECT_DIR, 'static'),
|
||||
)
|
||||
|
||||
STATICFILES_FINDERS = (
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
)
|
||||
|
||||
TEMPLATE_LOADERS = (
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
)
|
||||
|
||||
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.i18n',
|
||||
'django.core.context_processors.request',
|
||||
'django.core.context_processors.media',
|
||||
'django.core.context_processors.static',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
)
|
||||
|
||||
ROOT_URLCONF = 'urls'
|
||||
|
||||
TEMPLATE_DIRS = (
|
||||
os.path.join(PROJECT_DIR, 'templates'),
|
||||
)
|
||||
|
||||
INSTALLED_APPS = (
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.sites',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
# Custom apps below here.
|
||||
'{{ project_name }}',
|
||||
)
|
||||
|
||||
if DEBUG:
|
||||
INSTALLED_APPS += ('django.contrib.admin',)
|
||||
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'handlers': {
|
||||
'console': {
|
||||
'level': 'DEBUG' if DEBUG else 'INFO',
|
||||
'class': 'logging.StreamHandler',
|
||||
},
|
||||
},
|
||||
'loggers': {
|
||||
'': {
|
||||
'handlers': ['console'],
|
||||
'level': 'INFO',
|
||||
'propagate': True,
|
||||
},
|
||||
'{{ project_name }}': {
|
||||
'handlers': ['console'],
|
||||
'level': 'DEBUG' if DEBUG else 'INFO',
|
||||
'propagate': True,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Environment
|
||||
#
|
||||
|
||||
assert 'SECRET_KEY' in os.environ, 'Set SECRET_KEY in your .env file!'
|
||||
SECRET_KEY = os.environ['SECRET_KEY']
|
Loading…
Add table
Add a link
Reference in a new issue