forked from EGCETSII/decide_django_2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EGCETSII#43-fix: remove mongo version
- Loading branch information
Showing
2 changed files
with
212 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,210 @@ | ||
""" | ||
Django settings for decide project. | ||
Generated by 'django-admin startproject' using Django 2.0. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/2.0/topics/settings/ | ||
For the full list of settings and their values, see | ||
https://docs.djangoproject.com/en/2.0/ref/settings/ | ||
""" | ||
|
||
import os | ||
import django_heroku | ||
|
||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) | ||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
|
||
# Quick-start development settings - unsuitable for production | ||
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/ | ||
|
||
# SECURITY WARNING: keep the secret key used in production secret! | ||
SECRET_KEY = '^##ydkswfu0+=ofw0l#$kv^8n)0$i(qd&d&ol#p9!b$8*5%j1+' | ||
|
||
# SECURITY WARNING: don't run with debug turned on in production! | ||
DEBUG = True | ||
ALLOWED_HOSTS = ["*"] | ||
|
||
# Login redirect | ||
LOGIN_URL = '/authentication/login_form/' | ||
LOGIN_REDIRECT_URL = '/authentication/bienvenida/' | ||
|
||
# Application definition | ||
|
||
INSTALLED_APPS = [ | ||
'django.contrib.admin', | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'django.contrib.messages', | ||
'django.contrib.staticfiles', | ||
|
||
'corsheaders', | ||
'django_filters', | ||
'rest_framework', | ||
'rest_framework.authtoken', | ||
'rest_framework_swagger', | ||
'gateway', | ||
] | ||
|
||
REST_FRAMEWORK = { | ||
'DEFAULT_AUTHENTICATION_CLASSES': ( | ||
'rest_framework.authentication.BasicAuthentication', | ||
'rest_framework.authentication.TokenAuthentication', | ||
), | ||
'DEFAULT_VERSIONING_CLASS': 'rest_framework.versioning.QueryParameterVersioning' | ||
} | ||
|
||
AUTHENTICATION_BACKENDS = [ | ||
'base.backends.AuthBackend', | ||
] | ||
|
||
|
||
MODULES = [ | ||
'administration', | ||
'authentication', | ||
'base', | ||
'booth', | ||
'census', | ||
'voting', | ||
'mixnet', | ||
'postproc', | ||
'store', | ||
'visualizer', | ||
] | ||
|
||
ENV_DEVELOP = os.environ.get('ENV_DEVELOP', False) | ||
ENV_MAIN = os.environ.get('ENV_MAIN', False) | ||
|
||
if ENV_DEVELOP: | ||
BASEURL = 'https://decide-full-tortuga-admin-dev.herokuapp.com' | ||
elif ENV_MAIN: | ||
BASEURL = 'https://decide-full-tortuga-admin.herokuapp.com' | ||
else: | ||
BASEURL = 'http://localhost:8000' | ||
|
||
APIS = { | ||
'administration': BASEURL, | ||
'authentication': BASEURL, | ||
'base': BASEURL, | ||
'booth': BASEURL, | ||
'census': BASEURL, | ||
'mixnet': BASEURL, | ||
'postproc': BASEURL, | ||
'store': BASEURL, | ||
'visualizer': BASEURL, | ||
'voting': BASEURL, | ||
} | ||
|
||
MIDDLEWARE = [ | ||
'corsheaders.middleware.CorsMiddleware', # added to solve CORS | ||
'django.middleware.common.CommonMiddleware', # added to solve CORS | ||
'django.middleware.security.SecurityMiddleware', | ||
'django.contrib.sessions.middleware.SessionMiddleware', | ||
'django.middleware.csrf.CsrfViewMiddleware', | ||
'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
'django.contrib.messages.middleware.MessageMiddleware', | ||
'django.middleware.clickjacking.XFrameOptionsMiddleware', | ||
'corsheaders.middleware.CorsMiddleware' | ||
] | ||
|
||
ROOT_URLCONF = 'decide.urls' | ||
|
||
TEMPLATES = [ | ||
{ | ||
'BACKEND': 'django.template.backends.django.DjangoTemplates', | ||
'DIRS': [os.path.join(BASE_DIR, 'administration', 'frontend')], | ||
'APP_DIRS': True, | ||
'OPTIONS': { | ||
'context_processors': [ | ||
'django.template.context_processors.debug', | ||
'django.template.context_processors.request', | ||
'django.contrib.auth.context_processors.auth', | ||
'django.contrib.messages.context_processors.messages', | ||
], | ||
}, | ||
}, | ||
] | ||
|
||
STATIC_URL = '/static/' | ||
STATICFILES_DIRS = ( | ||
os.path.join(BASE_DIR, 'administration', 'frontend', 'build', 'static'), | ||
) | ||
|
||
WSGI_APPLICATION = 'decide.wsgi.application' | ||
|
||
# Database | ||
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'djongo', | ||
'NAME': 'decide', | ||
'CLIENT': { | ||
'host': '127.0.0.1', | ||
} | ||
} | ||
} | ||
|
||
# Password validation | ||
# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators | ||
|
||
AUTH_PASSWORD_VALIDATORS = [ | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', | ||
}, | ||
] | ||
|
||
# Internationalization | ||
# https://docs.djangoproject.com/en/2.0/topics/i18n/ | ||
|
||
LANGUAGE_CODE = 'en-us' | ||
|
||
TIME_ZONE = 'UTC' | ||
|
||
USE_I18N = True | ||
|
||
USE_L10N = True | ||
|
||
USE_TZ = True | ||
|
||
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' | ||
|
||
# Static files (CSS, JavaScript, Images) | ||
# https://docs.djangoproject.com/en/2.0/howto/static-files/ | ||
|
||
STATIC_URL = '/static/' | ||
|
||
# number of bits for the key, all auths should use the same number of bits | ||
KEYBITS = 256 | ||
|
||
# Versioning | ||
ALLOWED_VERSIONS = ['v1', 'v2'] | ||
DEFAULT_VERSION = 'v1' | ||
|
||
try: | ||
from local_settings import * | ||
except ImportError: | ||
print("local_settings.py not found") | ||
|
||
# loading jsonnet config | ||
if os.path.exists("config.jsonnet"): | ||
import json | ||
from _jsonnet import evaluate_file | ||
|
||
config = json.loads(evaluate_file("config.jsonnet")) | ||
for k, v in config.items(): | ||
vars()[k] = v | ||
|
||
INSTALLED_APPS = INSTALLED_APPS + MODULES | ||
django_heroku.settings(locals()) |