You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

280 lines
7.2 KiB
Python

"""
Django settings for ccvpn 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/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
from django.core.validators import RegexValidator
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.8/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '@4+zlzju0(wymvatr%8uguuc-aeap8yaz$269ftloqhd&vm%c4'
# 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_countries',
'lambdainst',
'payments',
'tickets',
'constance',
'constance.backends.database',
)
MIDDLEWARE = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.common.BrokenLinkEmailsMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.middleware.locale.LocaleMiddleware',
'lambdainst.middleware.ReferrerMiddleware',
'lambdainst.middleware.CampaignMiddleware',
)
ROOT_URLCONF = 'ccvpn.urls'
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.template.context_processors.i18n',
'django.template.context_processors.static',
'django.template.context_processors.csrf',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'ccvpn.context_processors.some_settings',
],
},
},
]
WSGI_APPLICATION = 'ccvpn.wsgi.application'
LOGIN_URL = 'account:login'
LOGOUT_URL = 'account:logout'
LOGIN_REDIRECT_URL = 'account:index'
LOGOUT_REDIRECT_URL = '/'
PAGES_DIR = BASE_DIR + '/pages/'
PASSWORD_HASHERS = [
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
'ccvpn.passwords.LegacyPasswordHasher',
]
# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/
LANGUAGE_CODE = 'en'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
LANGUAGES = (
('fr', "French"),
('en', "English"),
)
LOCALE_PATHS = (
os.path.join(BASE_DIR, 'locale/'),
)
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
# Security
X_FRAME_OPTIONS = 'SAMEORIGIN'
SESSION_COOKIE_SECURE = False
CSRF_COOKIE_SECURE = False
CSRF_COOKIE_HTTPONLY = True
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_BROWSER_XSS_FILTER = True
SECURE_SSL_REDIRECT = False
SECURE_HSTS_SECONDS = 3600
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
# Enable Discourse SSO
DISCOURSE_SSO = False
DISCOURSE_SECRET = '...'
DISCOURSE_URL = 'https://forum.ccrypto.org/'
# OpenVPN CA Certificate
with open(BASE_DIR + '/ccvpn/ca.crt') as ca_file:
OPENVPN_CA = ca_file.read()
# HTML added before </head>
ADDITIONAL_HEADER_HTML = ''
# HTML added before </body>
ADDITIONAL_HTML = ''
# Will replace the default contact us thing when not empty
SUPPORT_HTML = ''
# Custom per cluster message displayed config page
# 'cluster_name': "No P2P"
LAMBDAINST_CLUSTER_MESSAGES = {}
# Name used in ticket emails
TICKETS_SITE_NAME = 'CCrypto VPN Support'
# Full URL to the site root
ROOT_URL = ''
# Forwarded for header name, if any (None will use remote_addr)
REAL_IP_HEADER_NAME = None
# reCAPTCHA API details. If empty, no captcha is displayed.
RECAPTCHA_API = 'https://www.google.com/recaptcha/api/siteverify'
RECAPTCHA_SITE_KEY = ''
RECAPTCHA_SECRET_KEY = ''
# lcore API settings
LCORE = dict(
BASE_URL='https://core.test.lambdavpn.net/v1/',
API_KEY='',
API_SECRET='',
INST_SECRET='',
CACHE_TTL=10,
)
# VPN auth credentials and expiration time storage
# - if 'core', password and expiration_date will be replicated to core and
# auth will be done from there.
# - if 'inst', both will be kept here and core should call the API here to
# authenticate users.
# 'core' is faster and doesn't depend on the instance's stability, 'inst'
# lets you generate client_config dynamically.
# /!\ don't use 'core' with unit tests for now.
VPN_AUTH_STORAGE = 'inst'
# Payment & Trial
# Payment backends. See payments/backends.py for more infos.
PAYMENTS_BACKENDS = {
'bitcoin': {
'enabled': False,
'url': 'http://test:test@127.0.0.1:18332/',
# 'chain': '', # mainnet, testnet, regnet
},
'paypal': {
'enabled': False,
'test': True, # Sandbox
# 'api_base': '',
'address': '', # PayPal address to send to
# 'receiver': '', # PayPal primary address if different
# 'currency': 'EUR',
# 'header_image': '',
},
'stripe': {
'enabled': False,
'secret_key': '',
'public_key': '',
'currency': 'EUR',
# 'title': '',
# 'header_image': '',
},
'coingate': {
'enabled': False,
# 'sandbox': True,
# 'api_base': '',
'api_token': '',
'currency': 'EUR',
# 'title': '',
},
}
PAYMENTS_CURRENCY = ('eur', '')
CONSTANCE_BACKEND = 'constance.backends.database.DatabaseBackend'
CONSTANCE_CONFIG = {
'MOTD': ('', "Public site message, displayed on homepage"),
'MOTD_USER': ('', "Message for users, displayed on account home"),
'MONTHLY_PRICE_EUR': (300, "Base subscription price per month (x0.01€)"),
'BTC_EUR_VALUE': (300000, "Current value of a bitcoin (x0.01€/btc)"),
'TRIAL_PERIOD_HOURS': (2, "Hours given for each trial period"),
'TRIAL_PERIOD_MAX': (84, "Maximum number of trial periods to give (84*2h=1w)"),
'NOTIFY_DAYS_BEFORE': ("3, 1", "When to send account expiration notifications. In number of days before, separated y commas",
'integer_list'),
}
CONSTANCE_ADDITIONAL_FIELDS = {
'integer_list': ['django.forms.fields.CharField', {
'validators': [RegexValidator(r'^([0-9]+[ ,]+)*([0-9]+)?$')],
}],
}
# Local settings
try:
from .local_settings import * # noqa
except ImportError:
pass