camp/camp/settings.py

194 lines
5.1 KiB
Python
Raw Normal View History

2017-05-20 17:48:30 +05:30
"""
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
2025-03-25 22:30:47 +00:00
COMPRESS_ENABLED = True
2017-05-20 17:48:30 +05:30
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
2017-07-03 13:44:07 +05:30
'django.contrib.sites',
2017-12-05 19:10:17 +01:00
2025-03-25 17:09:27 +00:00
'compressor',
'sass_processor',
2017-12-19 11:39:13 +01:00
'braces',
2017-12-05 19:10:17 +01:00
'django_extensions',
2017-07-03 13:44:07 +05:30
'markdownx',
'sortedm2m',
2017-12-05 19:10:17 +01:00
2017-12-19 11:39:13 +01:00
'camp',
2017-05-20 18:15:26 +05:30
'content',
'photologue',
2017-05-20 17:48:30 +05:30
]
2017-07-03 13:44:07 +05:30
SITE_ID = 1
2017-05-20 17:48:30 +05:30
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',
2023-08-09 09:46:34 +00:00
#'django.middleware.clickjacking.XFrameOptionsMiddleware',
2017-05-20 17:48:30 +05:30
]
ROOT_URLCONF = 'camp.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
2019-07-29 11:09:50 +00:00
'DIRS': [
os.path.join(BASE_DIR, 'camp', 'templates')
],
2017-07-03 13:44:07 +05:30
'APP_DIRS': False,
2017-05-20 17:48:30 +05:30
'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',
2017-07-03 13:44:07 +05:30
'django.template.context_processors.media',
],
'loaders': [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
2017-05-20 17:48:30 +05:30
],
2025-01-17 10:17:56 +05:30
"builtins": [
"django.templatetags.static",
],
2017-05-20 17:48:30 +05:30
},
},
]
WSGI_APPLICATION = 'camp.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
DATABASES = {
'default': {
2017-07-03 13:44:07 +05:30
'ENGINE': 'django.db.backends.postgresql_psycopg2',
2017-05-20 17:48:30 +05:30
'NAME': 'camp',
2017-12-18 16:46:24 +01:00
'USER': '',
2017-05-20 17:48:30 +05:30
}
}
# 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
2017-07-03 13:44:07 +05:30
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
2017-05-20 17:48:30 +05:30
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_URL = '/static/'
2017-12-08 22:20:53 +01:00
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
2025-03-25 17:09:27 +00:00
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
"sass_processor.finders.CssFinder",
"compressor.finders.CompressorFinder",
)
MARKDOWNX_MEDIA_PATH = 'images/markdown'
2017-07-03 13:44:07 +05:30
MARKDOWNX_EDITOR_RESIZABLE = True
2025-01-30 17:28:29 +05:30
MARKDOWNX_MARKDOWNIFY_FUNCTION = 'content.utils.markdownify'
2017-07-03 13:44:07 +05:30
2025-01-10 15:52:31 +05:30
MEDIA_URL = '/static/images/'
2017-12-18 13:02:33 +00:00
MEDIA_ROOT = os.path.join(BASE_DIR, 'data/images')
2017-12-05 19:10:17 +01:00
2025-01-10 15:23:37 +05:30
IMAGE_PREFIX = 'https://studio.camp/images/'
2017-12-05 19:10:17 +01:00
2018-02-21 20:31:25 +05:30
CONTACT_FROM_EMAIL = 'contact@studio.camp'
CONTACT_TO_EMAIL = ['contact@studio.camp']
2018-08-21 11:28:16 +02:00
DATA_UPLOAD_MAX_MEMORY_SIZE = 150 * 1024 * 1024
2025-01-10 15:23:37 +05:30
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
2025-03-24 15:19:48 +00:00
PHOTOLOGUE_MULTISITE = False
try:
2025-01-10 15:23:37 +05:30
from .local_settings import *
except:
2017-12-05 19:10:17 +01:00
pass
2017-12-08 22:20:53 +01:00
# 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:
2018-08-21 11:28:16 +02:00
raise Exception('Please create a %s file with random characters to generate your secret key!' % SECRET_FILE)