· 8 years ago · Nov 24, 2017, 07:24 AM
1django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty
2
3export MYPROJECT_SECRET_KEY="very_long_fake_key"
4
5#mod_wsgi
6LoadModule wsgi_module modules/mod_wsgi.so
7
8WSGIScriptAlias / /home/shgr/projects/autozap/autozap/wsgi.py
9WSGIPythonHome /home/shgr/.virtualenvs/autozap
10WSGIPythonPath /home/shgr/projects/autozap/
11
12<Directory /home/shgr/projects/autozap/autozap>
13<Files wsgi.py>
14Require all granted
15</Files>
16</Directory>
17
18Alias /robots.txt /home/shgr/projects/autozap/static/robots.txt
19#Alias /favicon.ico /home/shgr/projects/autozap/favicon.ico
20
21Alias /media/ /home/shgr/projects/autozap/media/
22Alias /static/ /home/shgr/projects/autozap/static/
23
24<Directory /home/shgr/projects/autozap/static>
25Require all granted
26</Directory>
27
28<Directory /home/shgr/projects/autozap/media>
29Require all granted
30</Directory>
31
32#import_files
33Alias /import_files /home/shgr/projects/autozap/webdata/import_files
34<Directory /home/shgr/projects/autozap/webdata/import_files>
35Require all granted
36</Directory>
37
38import os
39
40# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
41BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
42REACT_APP_DIR = os.path.join(BASE_DIR, 'frontend')
43
44# Quick-start development settings - unsuitable for production
45# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
46
47# SECURITY WARNING: keep the secret key used in production secret!
48#SECRET_KEY = os.environ.get("AUTOZAP_SECRET_KEY")
49SECRET_KEY = "$hg@z4nus7^6!s7d-ku4ahjew_@!+&u1+*s7sq1--fake-fake"
50
51# SECURITY WARNING: don't run with debug turned on in production!
52DEBUG = False
53
54# Application definition
55
56INSTALLED_APPS = [
57 'django.contrib.admin',
58 'django.contrib.auth',
59 'django.contrib.contenttypes',
60 'django.contrib.sessions',
61 'django.contrib.messages',
62 'rest_framework',
63 'website',
64]
65# 'django.middleware.csrf.CsrfViewMiddleware'
66MIDDLEWARE = [
67 'django.middleware.security.SecurityMiddleware',
68 'django.contrib.sessions.middleware.SessionMiddleware',
69 'django.middleware.common.CommonMiddleware',
70 'django.contrib.auth.middleware.AuthenticationMiddleware',
71 'django.contrib.messages.middleware.MessageMiddleware',
72 'django.middleware.clickjacking.XFrameOptionsMiddleware',
73]
74
75ROOT_URLCONF = 'autozap.urls'
76
77TEMPLATES = [
78 {
79 'BACKEND': 'django.template.backends.django.DjangoTemplates',
80 'DIRS': [],
81 'APP_DIRS': True,
82 'OPTIONS': {
83 'context_processors': [
84 'django.template.context_processors.debug',
85 'django.template.context_processors.request',
86 'django.contrib.auth.context_processors.auth',
87 'django.contrib.messages.context_processors.messages'
88 ],
89 },
90 },
91]
92
93WSGI_APPLICATION = 'autozap.wsgi.application'
94
95
96# Password validation
97# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
98
99AUTH_PASSWORD_VALIDATORS = [
100 {
101 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
102 },
103 {
104 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
105 },
106 {
107 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
108 },
109 {
110 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
111 },
112]
113
114# Internationalization
115# https://docs.djangoproject.com/en/1.11/topics/i18n/
116
117LANGUAGE_CODE = 'ru-ru'
118
119TIME_ZONE = 'Asia/Krasnoyarsk'
120
121USE_I18N = True
122
123USE_L10N = True
124
125USE_TZ = True
126
127# Static files (CSS, JavaScript, Images)
128# https://docs.djangoproject.com/en/1.11/howto/static-files/
129
130STATIC_URL = '/static/'
131
132STATIC_ROOT = 'static'
133
134REST_FRAMEWORK = {
135 'UPLOADED_FILES_USE_URL': False
136}
137
138from autozap.settings.base import *
139
140import os
141
142# Quick-start development settings - unsuitable for production
143# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
144
145# SECURITY WARNING: keep the secret key used in production secret!
146
147# SECURITY WARNING: don't run with debug turned on in production!
148DEBUG = False
149
150ALLOWED_HOSTS = [
151 'fake.com',
152 'localhost',
153]
154
155#send_mail
156EMAIL_HOST = 'smtp.yandex.ru'
157EMAIL_PORT = 465
158EMAIL_HOST_USER = "fake@yandex.ru"
159EMAIL_USE_SSL = True
160EMAIL_HOST_PASSWORD = "fakefake"
161
162
163# Database
164# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
165
166
167DATABASES = {
168 'default': {
169 'ENGINE': 'django.db.backends.mysql',
170 'NAME': 'autozap',
171 'USER': 'root',
172 'PASSWORD': 'fake-fake',
173 'HOST': 'localhost',
174 'PORT': '3307',
175 'sql_mode': 'STRICT_TRANS_TABLES',
176 }
177}
178
179from autozap.settings.base import *
180
181import os
182
183DEBUG=True
184
185ALLOWED_HOSTS = [
186 'localhost'
187]
188
189INSTALLED_APPS += [
190 'django.contrib.staticfiles'
191]
192
193
194DATABASES = {
195 'default': {
196 'ENGINE': 'django.db.backends.mysql',
197 'NAME': 'autozap',
198 'USER': 'fake',
199 'PASSWORD': 'fakfake',
200 'HOST': 'localhost',
201 'PORT': '',
202 'sql_mode': 'STRICT_TRANS_TABLES',
203 }
204}
205
206#send_mail
207EMAIL_HOST = 'smtp.yandex.ru'
208EMAIL_PORT = 465
209EMAIL_HOST_USER = "fake@yandex.ru"
210EMAIL_USE_SSL = True
211EMAIL_HOST_PASSWORD = "fakfake"
212
213STATICFILES_DIRS = [
214 os.path.join(REACT_APP_DIR, 'build', 'static')
215]