· 7 years ago · Jan 09, 2019, 11:44 AM
1"""
2Django settings for decide project.
3
4Generated by 'django-admin startproject' using Django 2.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
13import os
14import django_heroku
15
16# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
17BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
18
19
20# Quick-start development settings - unsuitable for production
21# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
22
23# SECURITY WARNING: keep the secret key used in production secret!
24SECRET_KEY = '^##ydkswfu0+=ofw0l#$kv^8n)0$i(qd&d&ol#p9!b$8*5%j1+'
25
26# SECURITY WARNING: don't run with debug turned on in production!
27DEBUG = True
28
29ALLOWED_HOSTS = []
30
31# Application definition
32
33INSTALLED_APPS = [
34 'django.contrib.admin',
35 'django.contrib.auth',
36 'django.contrib.contenttypes',
37 'django.contrib.sessions',
38 'django.contrib.messages',
39 'django.contrib.staticfiles',
40
41 'corsheaders',
42 'django_filters',
43 'rest_framework',
44 'rest_framework.authtoken',
45 'rest_framework_swagger',
46]
47
48REST_FRAMEWORK = {
49 'DEFAULT_AUTHENTICATION_CLASSES': (
50 'rest_framework.authentication.BasicAuthentication',
51 'rest_framework.authentication.TokenAuthentication',
52 )
53}
54
55AUTHENTICATION_BACKENDS = [
56 'base.backends.EmailBackend',
57 'base.backends.AuthBackend',
58]
59
60MODULES = [
61 'authentication',
62 'base',
63 'booth',
64 'census',
65 'mixnet',
66 'postproc',
67 'store',
68 'visualizer',
69 'voting',
70]
71
72BASEURL = 'https://decide-ortosia.herokuapp.com'
73# BASEURL = 'http://localhost:8000'
74#BASEURL = 'https://decide-ortosia-visualizacion.herokuapp.com'
75
76MIDDLEWARE = [
77 'django.middleware.security.SecurityMiddleware',
78 'django.contrib.sessions.middleware.SessionMiddleware',
79 'django.middleware.common.CommonMiddleware',
80 'django.middleware.csrf.CsrfViewMiddleware',
81 'django.contrib.auth.middleware.AuthenticationMiddleware',
82 'django.contrib.messages.middleware.MessageMiddleware',
83 'django.middleware.clickjacking.XFrameOptionsMiddleware',
84]
85
86ROOT_URLCONF = 'decide.urls'
87
88TEMPLATES = [
89 {
90 'BACKEND': 'django.template.backends.django.DjangoTemplates',
91 'DIRS': [],
92 'APP_DIRS': True,
93 'OPTIONS': {
94 'context_processors': [
95 'django.template.context_processors.debug',
96 'django.template.context_processors.request',
97 'django.contrib.auth.context_processors.auth',
98 'django.contrib.messages.context_processors.messages',
99 ],
100 },
101 },
102]
103
104WSGI_APPLICATION = 'decide.wsgi.application'
105
106
107# Database
108# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
109
110DATABASES = {
111 'default': {
112 'ENGINE': 'django.db.backends.sqlite3',
113 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
114 }
115}
116
117
118# Password validation
119# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
120
121AUTH_PASSWORD_VALIDATORS = [
122 {
123 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
124 },
125 {
126 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
127 },
128 {
129 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
130 },
131 {
132 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
133 },
134]
135
136
137# Internationalization
138# https://docs.djangoproject.com/en/2.0/topics/i18n/
139
140LANGUAGE_CODE = 'en-us'
141
142TIME_ZONE = 'UTC'
143
144USE_I18N = True
145
146USE_L10N = True
147
148USE_TZ = True
149
150
151# Static files (CSS, JavaScript, Images)
152# https://docs.djangoproject.com/en/2.0/howto/static-files/
153
154STATIC_URL = '/static/'
155
156# number of bits for the key, all auths should use the same number of bits
157KEYBITS = 256
158
159APIS = {}
160
161try:
162 from local_settings import *
163except ImportError:
164 print("local_settings.py not found")
165
166
167INSTALLED_APPS = INSTALLED_APPS + MODULES
168
169STATICFILES_DIRS = [
170 os.path.join(BASE_DIR, "static"),
171 '/census/static/',
172]
173
174django_heroku.settings(locals())