-
Notifications
You must be signed in to change notification settings - Fork 3
/
dev_settings_template.py
167 lines (144 loc) · 4.37 KB
/
dev_settings_template.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
##############################################
# #
# Rename this file to dev_settings.py and #
# enter your values to his settings fields #
# #
##############################################
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '================= Your SECRET_KEY ================'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# DATABASES settings
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
# SQLite settings
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, '..', 'db.sqlite3'),
'TEST': {}
}
}
# MySQL settings
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.mysql',
# 'HOST': 'localhost',
# # 'USER': 'students_db_user',
# # 'PASSWORD': 'students_db_user_password',
# 'USER': 'root',
# 'PASSWORD': 'DBA_password',
# 'NAME': 'students_db',
# 'TEST': {
# 'CHARSET': 'utf8',
# 'COLLATION': 'utf8_general_ci',
# }
# }
# }
# PostgreSQL settings
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.postgresql_psycopg2',
# 'HOST': 'localhost',
# # 'USER': 'students_db_user',
# # 'PASSWORD': 'students_db_user_password',
# 'USER': 'root',
# 'PASSWORD': 'DBA_password',
# 'NAME': 'students_db',
# 'PORT': '',
# 'TEST': {
# 'CHARSET': 'utf8',
# 'COLLATION': 'utf8_general_ci',
# }
# }
# }
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/
# Static files
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'students', 'static')
# Media files
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, '..', 'media')
# Template files
TEMPLATE_DEBUG = True
TEMPLATE_DIRS = (os.path.join(BASE_DIR, 'studentsdb', 'templates'),
os.path.join(BASE_DIR, 'stud_auth', 'templates'),
os.path.join(BASE_DIR, 'students', 'templates', 'students'), )
# Social
SOCIAL_AUTH_FACEBOOK_KEY = '=== Your pub key ==='
SOCIAL_AUTH_FACEBOOK_SECRET = '=== Your sec key ==='
# Admins
ADMINS = (('John', 'john@example.com'),)
MANAGERS = (('Peter', 'peter@example.com'),)
# EMAIL settings (use SSL)
ADMIN_EMAIL = 'john@example.com'
EMAIL_HOST = 'smtp.example.com'
EMAIL_PORT = '465'
EMAIL_HOST_USER = 'sender@example.com'
EMAIL_HOST_PASSWORD = 'sender_password'
EMAIL_USE_TLS = False
EMAIL_USE_SSL = True
SERVER_EMAIL = 'sender@example.com'
DEFAULT_FROM_EMAIL = 'sender@example.com'
# Logging settings
LOG_FILE = os.path.join(BASE_DIR, 'studentsdb.log')
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s: %(message)s'
},
'simple': {
'format': '%(levelname)s: %(message)s'
},
},
'handlers': {
'null': {
'level': 'DEBUG',
'class': 'logging.NullHandler'
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'simple'
},
'file': {
'level': 'INFO',
'class': 'logging.FileHandler',
'filename': LOG_FILE,
'formatter': 'verbose'
},
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django': {
'handlers': ['null'],
'propagate': True,
'level': 'INFO'
},
'django.request': {
'handlers': ['file', 'mail_admins'],
'level': 'ERROR',
'propagate': False,
},
'students.signals': {
'handlers': ['console', 'file', 'mail_admins'],
'level': 'INFO'
},
'registration.signals': {
'handlers': ['console', 'file', 'mail_admins'],
'level': 'INFO'
},
'students.views.contact_admin': {
'handlers': ['console', 'file', 'mail_admins'],
'level': 'INFO'
}
}
}