-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
133 lines (106 loc) · 3.23 KB
/
settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
"""
Django settings for Finetooth.
"""
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
IS_DEVELOPMENT = os.path.exists('.development')
DEBUG = os.environ.get('DEBUG') or IS_DEVELOPMENT
if IS_DEVELOPMENT:
SECRET_KEY = os.environ.get('SECRET_KEY') or "fake_development_unsecret_key"
else:
SECRET_KEY = os.environ.get('SECRET_KEY')
TEMPLATE_DEBUG = DEBUG
ALLOWED_HOSTS = ['*']
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'bootstrap3',
'core',
)
if DEBUG:
INSTALLED_APPS += ('debug_toolbar',)
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',
)
ROOT_URLCONF = 'urls'
WSGI_APPLICATION = 'wsgi.application'
if IS_DEVELOPMENT:
DATABASES = {
'default': {
# I <3 SQLite but maybe consider Postgres if/when deploying this
# somewhere
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join('db.sqlite3'),
}
}
else:
import dj_database_url
DATABASES = {'default': dj_database_url.config()}
AUTH_USER_MODEL = "core.FinetoothUser"
AUTH_REDIRECT_URL = "/"
if DEBUG:
PASSWORD_HASHERS = ('django.contrib.auth.hashers.MD5PasswordHasher',)
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = False
TEMPLATE_DIRS = ('templates',)
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.tz',
'django.contrib.messages.context_processors.messages',
'core.context_processors.tag_cloud_context_processor',
'core.context_processors.contextual_static_serving_context_processor'
)
STATIC_ROOT = 'staticfiles'
STATICFILES_DIRS = ('static',)
SERVE_STATIC_LIBS_LOCALLY = (os.environ.get('SERVE_STATIC_LIBS_LOCALLY')
or IS_DEVELOPMENT)
STATIC_URL = '/static/'
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'log_format': {
'format' : ("[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] "
"%(message)s")
},
},
'handlers': {
'file': {
'level': 'INFO',
'class': 'logging.handlers.RotatingFileHandler',
'maxBytes': 1 * (1024)**2, # 1 MiB
'backupCount': 3,
'filename': 'logs/finetooth.log',
'formatter': 'log_format'
},
},
'loggers': {
'django': {
'handlers':['file'],
'propagate': True,
'level':'INFO',
},
'core': {
'handlers': ['file'],
'propogate': True,
'level': 'INFO',
},
}
}
POSTS_PER_PAGE = 15