Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
taskbuster-boilerplate/taskbuster/settings/base.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
116 lines (91 sloc)
2.93 KB
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
# -*- coding: utf-8 -*- | |
""" | |
Django settings for taskbuster project. | |
Generated by 'django-admin startproject' using Django 1.8. | |
For more information on this file, see | |
https://docs.djangoproject.com/en/1.8/topics/settings/ | |
For the full list of settings and their values, see | |
https://docs.djangoproject.com/en/1.8/ref/settings/ | |
""" | |
import os | |
# Base Dir points to the taskbuster folder | |
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
# Get SECRET_KEY from the virtual environment | |
from django.core.exceptions import ImproperlyConfigured | |
def get_env_variable(var_name): | |
try: | |
return os.environ[var_name] | |
except KeyError: | |
error_msg = "Set the %s environment variable" % var_name | |
raise ImproperlyConfigured(error_msg) | |
SECRET_KEY = get_env_variable('SECRET_KEY') | |
# Production settings | |
ALLOWED_HOSTS = [] | |
# Application definition | |
INSTALLED_APPS = ( | |
'django.contrib.admin', | |
'django.contrib.auth', | |
'django.contrib.contenttypes', | |
'django.contrib.sessions', | |
'django.contrib.messages', | |
'django.contrib.staticfiles', | |
) | |
MIDDLEWARE_CLASSES = ( | |
'django.contrib.sessions.middleware.SessionMiddleware', | |
'django.middleware.locale.LocaleMiddleware', | |
'django.middleware.common.CommonMiddleware', | |
'django.middleware.csrf.CsrfViewMiddleware', | |
'django.contrib.auth.middleware.AuthenticationMiddleware', | |
'django.contrib.auth.middleware.SessionAuthenticationMiddleware', | |
'django.contrib.messages.middleware.MessageMiddleware', | |
'django.middleware.clickjacking.XFrameOptionsMiddleware', | |
'django.middleware.security.SecurityMiddleware', | |
) | |
ROOT_URLCONF = 'taskbuster.urls' | |
WSGI_APPLICATION = 'taskbuster.wsgi.application' | |
# Database | |
# https://docs.djangoproject.com/en/dev/ref/settings/#databases | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.sqlite3', | |
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), | |
} | |
} | |
# Internationalization | |
from django.utils.translation import ugettext_lazy as _ | |
LANGUAGE_CODE = 'en-us' | |
USE_I18N = True | |
LANGUAGES = ( | |
('en', _('English')), | |
('ca', _('Catalan')), | |
) | |
LOCALE_PATHS = ( | |
os.path.join(BASE_DIR, 'locale'), | |
) | |
# Localization | |
USE_L10N = True | |
# Time Zone support | |
USE_TZ = True | |
TIME_ZONE = 'Europe/Madrid' | |
# Static files (CSS, JavaScript, Images) | |
STATIC_URL = '/static/' | |
STATICFILES_DIRS = ( | |
os.path.join(BASE_DIR, "static"), | |
) | |
# Templates files | |
TEMPLATES = [ | |
{ | |
'BACKEND': 'django.template.backends.django.DjangoTemplates', | |
'DIRS': [os.path.join(BASE_DIR, "templates")], | |
'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', | |
'django.template.context_processors.i18n', | |
], | |
}, | |
}, | |
] |