· 7 years ago · Mar 09, 2018, 07:52 AM
1"""
2Django settings for suorganizer project.
3
4Generated by 'django-admin startproject' using Django 1.8.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/1.8/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/1.8/ref/settings/
11"""
12
13# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
14import os
15
16BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17
18
19# Quick-start development settings - unsuitable for production
20# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
21
22SITE_ID = 1
23
24# SECURITY WARNING: keep the secret key used in production secret!
25SECRET_KEY = 'l)zht&^pddidsyqe$+09%se1*ba2#b_q-!j0^v$(-3c-=-vmq4'
26
27# SECURITY WARNING: don't run with debug turned on in production!
28DEBUG = True
29
30ALLOWED_HOSTS = []
31
32
33# Application definition
34
35INSTALLED_APPS = (
36 'django.contrib.admin',
37 'django.contrib.auth',
38 'django.contrib.contenttypes',
39 'django.contrib.sessions',
40 'django.contrib.messages',
41 'django.contrib.sites',
42 'django.contrib.staticfiles',
43 'django_extensions',
44 'core',
45 'organizer',
46 'blog',
47 'contact',
48)
49
50MIDDLEWARE_CLASSES = (
51 'django.contrib.sessions.middleware.SessionMiddleware',
52 'django.middleware.common.CommonMiddleware',
53 'django.middleware.csrf.CsrfViewMiddleware',
54 'django.contrib.auth.middleware.AuthenticationMiddleware',
55 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
56 'django.contrib.messages.middleware.MessageMiddleware',
57 'django.middleware.clickjacking.XFrameOptionsMiddleware',
58 'django.middleware.security.SecurityMiddleware',
59)
60
61ROOT_URLCONF = 'suorganizer.urls'
62
63TEMPLATES = [{
64 'BACKEND': 'django.template.backends.django.DjangoTemplates',
65 'DIRS': [
66 os.path.join(BASE_DIR, 'templates'),
67 ],
68 'APP_DIRS': True,
69 'OPTIONS': {
70 'context_processors': [
71 'django.template.context_processors.debug',
72 'django.template.context_processors.request',
73 'django.contrib.auth.context_processors.auth',
74 'django.contrib.messages.context_processors.messages',
75 ],
76 },
77}]
78
79WSGI_APPLICATION = 'suorganizer.wsgi.application'
80
81
82# Database
83# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
84
85DATABASES = {
86 'default': {
87 'ENGINE': 'django.db.backends.sqlite3',
88 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
89 }
90}
91
92
93# Logging
94# https://docs.djangoproject.com/en/1.8/topics/logging/
95
96from .log_filters import ManagementFilter
97
98verbose = (
99 "[%(asctime)s] %(levelname)s "
100 "[%(name)s:%(lineno)s] %(message)s")
101
102LOGGING = {
103 'version': 1,
104 'disable_existing_loggers': False,
105 'filters': {
106 'remove_migration_sql': {
107 '()': ManagementFilter,
108 },
109 },
110 'handlers': {
111 'console': {
112 'filters': ['remove_migration_sql'],
113 'class': 'logging.StreamHandler',
114 },
115 },
116 'formatters': {
117 'verbose': {
118 'format': verbose,
119 'datefmt': "%Y-%b-%d %H:%M:%S"
120 },
121 },
122 'loggers': {
123 'django': {
124 'handlers': ['console'],
125 'level': 'DEBUG',
126 'formatter': 'verbose'
127 },
128 },
129}
130
131
132# Email
133# https://docs.djangoproject.com/en/1.8/topics/email/
134
135EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
136SERVER_EMAIL = 'contact@django-unleashed.com'
137DEFAULT_FROM_EMAIL = 'no-reply@django-unleashed.com'
138EMAIL_SUBJECT_PREFIX = '[Startup Organizer] '
139MANAGERS = (
140 ('Us', 'ourselves@django-unleashed.com'),
141)
142
143# Internationalization
144# https://docs.djangoproject.com/en/1.8/topics/i18n/
145
146LANGUAGE_CODE = 'en-us'
147
148TIME_ZONE = 'UTC'
149
150USE_I18N = True
151
152USE_L10N = True
153
154USE_TZ = True
155
156
157# Static files (CSS, JavaScript, Images)
158# https://docs.djangoproject.com/en/1.8/howto/static-files/
159
160STATIC_URL = '/static/'
161STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)