· 7 years ago · May 13, 2018, 11:58 AM
1"""
2Django settings for Epitome project.
3
4Generated by 'django-admin startproject' using Django 2.0.0.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/2.0/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/2.0/ref/settings/
11"""
12
13
14import os
15PROJECT_PATH = os.path.realpath(os.path.dirname(__file__))
16
17# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
18BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
19
20
21
22# Quick-start development settings - unsuitable for production
23# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
24
25# SECURITY WARNING: keep the secret key used in production secret!
26try:
27 SECRET_KEY
28except NameError:
29 SECRET_FILE = os.path.join(PROJECT_PATH, 'secret.txt')
30 try:
31 SECRET_KEY = open(SECRET_FILE).read().strip()
32 except IOError:
33 try:
34 import random
35 SECRET_KEY = ''.join([random.SystemRandom().choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)])
36 secret = file(SECRET_FILE, 'w')
37 secret.write(SECRET_KEY)
38 secret.close()
39 except IOError:
40 Exception('Please create a %s file with random characters \
41 to generate your secret key!' % SECRET_FILE)
42
43# SECURITY WARNING: don't run with debug turned on in production!
44DEBUG = True
45
46ALLOWED_HOSTS = []
47
48
49# Application definition
50
51INSTALLED_APPS = [
52 'django.contrib.admin',
53 'django.contrib.auth',
54 'django.contrib.contenttypes',
55 'django.contrib.sessions',
56 'django.contrib.messages',
57 'django.contrib.staticfiles',
58 'Agora',
59 'Propylaea',
60 'Demoscopesis',
61]
62
63MIDDLEWARE = [
64 'django.middleware.security.SecurityMiddleware',
65 'django.contrib.sessions.middleware.SessionMiddleware',
66 'django.middleware.common.CommonMiddleware',
67 'django.middleware.csrf.CsrfViewMiddleware',
68 'django.contrib.auth.middleware.AuthenticationMiddleware',
69 'django.contrib.messages.middleware.MessageMiddleware',
70 'django.middleware.clickjacking.XFrameOptionsMiddleware',
71]
72
73ROOT_URLCONF = 'Epitome.urls'
74
75TEMPLATES = [
76 {
77 'BACKEND': 'django.template.backends.django.DjangoTemplates',
78 'DIRS': [os.path.join(BASE_DIR, 'templates')],
79 'APP_DIRS': True,
80 'OPTIONS': {
81 'context_processors': [
82 'django.template.context_processors.debug',
83 'django.template.context_processors.request',
84 'django.contrib.auth.context_processors.auth',
85 'django.contrib.messages.context_processors.messages',
86 ],
87 },
88 },
89]
90
91WSGI_APPLICATION = 'Epitome.wsgi.application'
92
93
94# Database
95# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
96
97DATABASES = {
98 'default': {
99 'ENGINE': 'django.db.backends.sqlite3',
100 'NAME': os.path.join(BASE_DIR, 'Atlas.sqlite3'),
101 }
102}
103
104
105# Password validation
106# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
107
108AUTH_PASSWORD_VALIDATORS = [
109 {
110 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
111 },
112 {
113 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
114 },
115 {
116 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
117 },
118 {
119 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
120 },
121]
122
123
124# Internationalization
125# https://docs.djangoproject.com/en/2.0/topics/i18n/
126
127LANGUAGE_CODE = 'en-us'
128
129TIME_ZONE = 'UTC'
130
131USE_I18N = True
132
133USE_L10N = True
134
135USE_TZ = True
136
137
138# Static files (CSS, JavaScript, Images)
139# https://docs.djangoproject.com/en/2.0/howto/static-files/
140
141STATIC_URL = '/static/'
142
143STATICFILES_DIRS = [
144 os.path.join(BASE_DIR, "static")
145]