· 9 years ago · Aug 24, 2016, 01:30 PM
1# -*- coding:utf-8 -*-
2
3# Django settings for bilet2u project.
4import os
5
6PROJECT_ROOT = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../')
7INSTANCE_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
8
9INSTANCE_SPECIFIC_DJANGO_DEBUG = True
10INSTANCE_SPECIFIC_DJANGO_DEBUG_STATIC = True
11
12if INSTANCE_ROOT.startswith('/home/beatum/charm/siwork/bilet2you.ru'):
13 INSTANCE_SPECIFIC_DJANGO_DEBUG = True
14 INSTANCE_SPECIFIC_DJANGO_DEBUG_STATIC = True
15elif INSTANCE_ROOT == '/home/beatum/charm/siwork/bilet2you.ru':
16 INSTANCE_SPECIFIC_DJANGO_DEBUG = False
17 INSTANCE_SPECIFIC_DJANGO_DEBUG_STATIC = False
18else:
19 print u'Попытка запуÑтить новую копию Ñайта. '
20 print u'Укажите наÑтройки Ð´Ð»Ñ Ð½Ð¾Ð²Ð¾Ð¹ копии Ñайта в файле settings.py'
21 print u"Путь до копии Ñайта: " + INSTANCE_ROOT
22 print u'Путь до settings.py' + __file__
23 raise RuntimeError("See above.")
24
25PARSER_URL = 'http://89.253.230.9/'
26
27if INSTANCE_SPECIFIC_DJANGO_DEBUG:
28 DEBUG = True
29 TEMPLATE_DEBUG = True
30else:
31 DEBUG = False
32 TEMPLATE_DEBUG = False
33
34ADMINS = (
35 ('erdmko', 'erdmko@numart.ru'),
36)
37
38MANAGERS = ADMINS
39SEND_BROKEN_LINK_EMAILS = True
40AUTH_PROFILE_MODULE = 'user_profile.UserProfile'
41
42DATABASES = {
43 'default': {
44 'ENGINE': 'django.db.backends.mysql',
45 # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
46 'NAME': 'bilet2u', # Or path to database file if using sqlite3.
47 'USER': 'root', # Not used with sqlite3.
48 'PASSWORD': 'zsefvcxd', # Not used with sqlite3.
49 'HOST': '127.0.0.1', # Set to empty string for localhost. Not used with sqlite3.
50 'PORT': '', # Set to empty string for default. Not used with sqlite3.
51 'OPTIONS': {
52 "init_command": "SET foreign_key_checks = 0;",
53 }
54 }
55}
56
57PREPEND_WWW = False
58
59EMAIL_HOST = '81.177.140.133'
60EMAIL_PORT = '587'
61EMAIL_HOST_USER = 'info@bilet2u.ru'
62EMAIL_HOST_PASSWORD = 'bilet2u'
63
64# Local time zone for this installation. Choices can be found here:
65# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
66# although not all choices may be available on all operating systems.
67# On Unix systems, a value of None will cause Django to use the same
68# timezone as the operating system.
69# If running in a Windows environment this must be set to the same as your
70# system time zone.
71TIME_ZONE = 'Europe/Moscow'
72
73# Language code for this installation. All choices can be found here:
74# http://www.i18nguy.com/unicode/language-identifiers.html
75LANGUAGE_CODE = 'ru-ru'
76
77SITE_ID = 1
78
79# If you set this to False, Django will make some optimizations so as not
80# to load the internationalization machinery.
81USE_I18N = True
82
83# If you set this to False, Django will not format dates, numbers and
84# calendars according to the current locale
85USE_L10N = True
86
87# Absolute filesystem path to the directory that will hold user-uploaded files.
88# Example: "/home/media/media.lawrence.com/media/"
89
90# Тут Ñпециально так задана медиа, чтобы Ð´Ð»Ñ Ð¾Ñновной копии она была задана папкой в оÑновной копии
91# а Ð´Ð»Ñ Ð¿Ñ€Ð¾Ð³-копий - чтобы бралаÑÑŒ медиа из папки оÑновной коппи. Так же как и база - папка - Ð¾Ð±Ñ‰Ð°Ñ Ð½Ð° вÑе копии.
92# media Брать из /media/ на боевом, а на прог-копии - из /media/ боевого.
93MEDIA_URL = '/media/'
94MEDIA_ROOT = os.path.join(PROJECT_ROOT, "httpdocs/media/")
95
96
97# Статику брать из папки /static/ на боевом, а на прог-копии - и папок app/static
98# media Брать из /media/ на боевом, а на прог-копии - из /media/ боевого.
99STATIC_URL = '/static/'
100if INSTANCE_SPECIFIC_DJANGO_DEBUG_STATIC:
101 STATICFILES_DIRS = (
102 # Тут важно без начального Ñлеша, Ñ‚.е. Ð½ÐµÐ»ÑŒÐ·Ñ /static/, Ñ‚.к. os.path.join возвращает
103 # отноÑительный путь а не абÑолютный Ñ‚.е. путь вида "static/" она и вернет и еÑли
104 # начальный Ñлеш то при нахождении Ñтатики Ñтот путь уже будет ÑчитатьÑÑ Ð°Ð±Ñолютным и
105 # Ñ‚.к. его нет в ÑиÑтеме и Ñтатика находитьÑÑ Ð½Ðµ будет.
106 os.path.join(INSTANCE_ROOT, "bilet2u/assets/"),
107 os.path.join(PROJECT_ROOT, "httpdocs/static/"),
108 )
109else:
110 STATIC_ROOT = os.path.join(PROJECT_ROOT, 'httpdocs/static/')
111
112
113# URL prefix for admin static files -- CSS, JavaScript and images.
114# Make sure to use a trailing slash.
115# Examples: "http://foo.com/static/admin/", "/static/admin/".
116ADMIN_MEDIA_PREFIX = '/static/admin/'
117
118
119# List of finder classes that know how to find static files in
120# various locations.
121STATICFILES_FINDERS = (
122 'django.contrib.staticfiles.finders.FileSystemFinder',
123 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
124 # 'django.contrib.staticfiles.finders.DefaultStorageFinder',
125)
126
127# Make this unique, and don't share it with anybody.
128SECRET_KEY = 's)1pcqj1&w_*q3lpfav$85eq^x!eq0i=qt4lr-opoybhksjpjg'
129
130# List of callables that know how to import templates from various sources.
131TEMPLATE_LOADERS = (
132 'django.template.loaders.filesystem.Loader',
133 'django.template.loaders.app_directories.Loader',
134 # 'django.template.loaders.eggs.Loader',
135)
136CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
137MIDDLEWARE_CLASSES = (
138 'django.middleware.common.CommonMiddleware',
139 'django.contrib.sessions.middleware.SessionMiddleware',
140 # 'django.middleware.csrf.CsrfViewMiddleware',
141 'django.middleware.csrf.CsrfResponseMiddleware',
142 'django.contrib.auth.middleware.AuthenticationMiddleware',
143 'django.contrib.messages.middleware.MessageMiddleware',
144 'django.middleware.cache.UpdateCacheMiddleware',
145 'django.middleware.cache.FetchFromCacheMiddleware',
146 'bilet2u.middleware.call_me_form_middle',
147 'bilet2u.middleware.get_ticket_form_middle',
148)
149
150INTERNAL_IPS = ('127.0.0.1',)
151SPHINX_PORT = 9306
152SPHINX_HOST = '127.0.0.1'
153
154ROOT_URLCONF = 'bilet2u.urls'
155
156import os.path
157
158TEMPLATE_DIRS = (
159 os.path.join(os.path.dirname(__file__), 'templates').replace('\\', '/'),
160)
161
162
163CACHES = {
164 'default': {
165 'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
166 }
167}
168
169# CACHES = {
170# 'default': {
171# 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
172# 'LOCATION': '127.0.0.1:11211',
173# }
174# }
175
176INSTALLED_APPS = (
177 'django.contrib.auth',
178 'django.contrib.contenttypes',
179 'django.contrib.sessions',
180 'django.contrib.sites',
181 'django.contrib.messages',
182 'django.contrib.staticfiles',
183 'django.contrib.admin',
184 'django.contrib.sitemaps',
185 'bilet2u.site_settings',
186 'bilet2u.txt',
187 'bilet2u.events',
188 'bilet2u.customdesc',
189 'bilet2u.user_profile',
190 'sorl.thumbnail',
191 'south',
192 'endless_pagination',
193 # 'django_cron',
194 'ckeditor',
195 #'raven.contrib.django.raven_compat',
196 # 'django_extensions',
197)
198CKEDITOR_UPLOAD_PATH = os.path.join('/home/beatum/charm/siwork/bilet2you.ru/httpdocs/media/uploads/')
199
200ENDLESS_PAGINATION_PER_PAGE = 3
201
202TEMPLATE_CONTEXT_PROCESSORS = (
203 'django.contrib.auth.context_processors.auth',
204 'django.core.context_processors.debug',
205 'django.core.context_processors.i18n',
206 'django.core.context_processors.media',
207 'django.core.context_processors.static',
208 'django.core.context_processors.request',
209 'django.contrib.messages.context_processors.messages',
210 'bilet2u.processor.extra_var',
211 'django.core.context_processors.request',
212)
213
214# A sample logging configuration. The only tangible logging
215# performed by this configuration is to send an email to
216# the site admins on every HTTP 500 error.
217# See http://docs.djangoproject.com/en/dev/topics/logging for
218# more details on how to customize your logging configuration.
219LOGGING = {
220 'version': 1,
221 'disable_existing_loggers': False,
222 'formatters': {
223 'verbose': {
224 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
225 },
226 'simple': {
227 'format': '%(levelname)s %(message)s'
228 },
229 },
230 'handlers': {
231 'mail_admins': {
232 'level': 'ERROR',
233 'class': 'django.utils.log.AdminEmailHandler'
234 },
235 'console': {
236 'level': 'DEBUG',
237 'class': 'logging.StreamHandler',
238 'formatter': 'simple'
239 },
240 },
241 'loggers': {
242 'bilet2u': {
243 'handlers': ['console'],
244 'level': 'DEBUG',
245 },
246 'django.request': {
247 'handlers': ['mail_admins'],
248 'level': 'ERROR',
249 'propagate': True,
250 'include_html': True
251 },
252 }
253}
254
255# Apps config
256RAVEN_CONFIG = {
257 'dsn': 'http://f7486ede5a2d4c1eb7466738886bc322:47b6989211e945a8b9e94178beb6d1bc@128.199.58.220/10',
258}