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.

240 lines
6.1 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 datetime import timedelta
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',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.common.BrokenLinkEmailsMiddleware',
'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',
'django.middleware.locale.LocaleMiddleware',
'lambdainst.middleware.ReferrerMiddleware',
)
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 = 'ccvpn.views.index'
LOGOUT_REDIRECT_URL = 'ccvpn.views.index'
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 = ''
# 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 = ''
# 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 = {
'paypal': {
'TEST': True, # Sandbox
'ADDRESS': 'paypal@ccrypto.org', # Your PayPal primary address
},
# Remove the leading '_' to enable these backends.
'_stripe': {
'API_KEY': '',
'PUBLIC_KEY': '',
},
'_bitcoin': {
'URL': 'http://test:test@127.0.0.1:18332/',
'BITCOIN_VALUE': 36000, # Value of one bitcoin in currency*100
},
}
PAYMENTS_CURRENCY = ('eur', '')
PAYMENTS_MONTHLY_PRICE = 300 # in currency*100
TRIAL_PERIOD = timedelta(hours=2) # Time added on each trial awarded
TRIAL_PERIOD_LIMIT = 2 # 2 * 2h = 4h, still has to push the button twice
NOTIFY_DAYS_BEFORE = (3, 1) # notify twice: 3 and 1 days before expiration
# Local settings
try:
from .local_settings import * # noqa
except ImportError:
pass