170 lines
4.4 KiB
Python
170 lines
4.4 KiB
Python
"""
|
|
Django settings for camp project.
|
|
|
|
Generated by 'django-admin startproject' using Django 1.11.1.
|
|
|
|
For more information on this file, see
|
|
https://docs.djangoproject.com/en/1.11/topics/settings/
|
|
|
|
For the full list of settings and their values, see
|
|
https://docs.djangoproject.com/en/1.11/ref/settings/
|
|
"""
|
|
|
|
import os
|
|
|
|
# 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/1.11/howto/deployment/checklist/
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
DEBUG = True
|
|
|
|
ALLOWED_HOSTS = []
|
|
|
|
|
|
# Application definition
|
|
|
|
INSTALLED_APPS = [
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'django.contrib.sites',
|
|
'content',
|
|
'markdownx',
|
|
'photologue',
|
|
'sortedm2m',
|
|
'braces',
|
|
]
|
|
|
|
SITE_ID = 1
|
|
|
|
MIDDLEWARE = [
|
|
'django.middleware.security.SecurityMiddleware',
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
'django.middleware.common.CommonMiddleware',
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
]
|
|
|
|
ROOT_URLCONF = 'camp.urls'
|
|
|
|
TEMPLATES = [
|
|
{
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
'DIRS': [],
|
|
'APP_DIRS': False,
|
|
'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.media',
|
|
],
|
|
'loaders': [
|
|
'app_namespace.Loader',
|
|
'django.template.loaders.filesystem.Loader',
|
|
'django.template.loaders.app_directories.Loader',
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
WSGI_APPLICATION = 'camp.wsgi.application'
|
|
|
|
|
|
# Database
|
|
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
|
'NAME': 'camp',
|
|
'USER': 'vaishk',
|
|
}
|
|
}
|
|
|
|
|
|
# Password validation
|
|
# https://docs.djangoproject.com/en/1.11/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/1.11/topics/i18n/
|
|
|
|
LANGUAGE_CODE = 'en-us'
|
|
|
|
TIME_ZONE = 'UTC'
|
|
|
|
USE_I18N = True
|
|
|
|
USE_L10N = True
|
|
|
|
USE_TZ = True
|
|
|
|
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
# https://docs.djangoproject.com/en/1.11/howto/static-files/
|
|
STATIC_URL = '/static/'
|
|
|
|
STATIC_ROOT = ''
|
|
|
|
STATICFILES_DIRS = (os.path.join(SITE_ROOT, 'static'), )
|
|
|
|
MARKDOWNX_MEDIA_PATH = os.path.join(BASE_ROOT, 'data/images')
|
|
|
|
|
|
MARKDOWNX_EDITOR_RESIZABLE = True
|
|
|
|
MEDIA_URL = '/images/'
|
|
MEDIA_ROOT = os.path.join(BASE_ROOT, 'data/images')
|
|
|
|
IMAGE_PREFIX = 'http://studio.camp/images/'
|
|
|
|
try:
|
|
from local_settings import *
|
|
except:
|
|
pass
|
|
|
|
# Make this unique, creates random key first at first time.
|
|
try:
|
|
SECRET_KEY
|
|
except NameError:
|
|
SECRET_FILE = os.path.join(BASE_DIR, 'secret.txt')
|
|
try:
|
|
SECRET_KEY = open(SECRET_FILE).read().strip()
|
|
except IOError:
|
|
try:
|
|
from django.utils.crypto import get_random_string
|
|
chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
|
|
SECRET_KEY = get_random_string(50, chars)
|
|
secret = open(SECRET_FILE, 'w')
|
|
secret.write(SECRET_KEY)
|
|
secret.close()
|
|
except IOError:
|
|
Exception('Please create a %s file with random characters to generate your secret key!' % SECRET_FILE)
|