CCrypto VPN public website https://vpn.ccrypto.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

281 lines
7.3 KiB

  1. """
  2. Django settings for ccvpn project.
  3. Generated by 'django-admin startproject' using Django 1.8.
  4. For more information on this file, see
  5. https://docs.djangoproject.com/en/1.8/topics/settings/
  6. For the full list of settings and their values, see
  7. https://docs.djangoproject.com/en/1.8/ref/settings/
  8. """
  9. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  10. import os
  11. from django.core.validators import RegexValidator
  12. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  13. # Quick-start development settings - unsuitable for production
  14. # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
  15. # SECURITY WARNING: keep the secret key used in production secret!
  16. SECRET_KEY = '@4+zlzju0(wymvatr%8uguuc-aeap8yaz$269ftloqhd&vm%c4'
  17. # SECURITY WARNING: don't run with debug turned on in production!
  18. DEBUG = True
  19. ALLOWED_HOSTS = []
  20. # Application definition
  21. INSTALLED_APPS = (
  22. 'django.contrib.admin',
  23. 'django.contrib.auth',
  24. 'django.contrib.contenttypes',
  25. 'django.contrib.sessions',
  26. 'django.contrib.messages',
  27. 'django.contrib.staticfiles',
  28. 'django_countries',
  29. 'lambdainst',
  30. 'payments',
  31. 'tickets',
  32. 'downloads',
  33. 'constance',
  34. 'constance.backends.database',
  35. )
  36. MIDDLEWARE = (
  37. 'django.contrib.sessions.middleware.SessionMiddleware',
  38. 'django.middleware.common.CommonMiddleware',
  39. 'django.middleware.common.BrokenLinkEmailsMiddleware',
  40. 'django.middleware.csrf.CsrfViewMiddleware',
  41. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  42. 'django.contrib.messages.middleware.MessageMiddleware',
  43. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  44. 'django.middleware.security.SecurityMiddleware',
  45. 'django.middleware.locale.LocaleMiddleware',
  46. 'lambdainst.middleware.ReferrerMiddleware',
  47. 'lambdainst.middleware.CampaignMiddleware',
  48. )
  49. ROOT_URLCONF = 'ccvpn.urls'
  50. TEMPLATES = [
  51. {
  52. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  53. 'DIRS': [
  54. os.path.join(BASE_DIR, 'templates/'),
  55. ],
  56. 'APP_DIRS': True,
  57. 'OPTIONS': {
  58. 'context_processors': [
  59. 'django.template.context_processors.debug',
  60. 'django.template.context_processors.request',
  61. 'django.template.context_processors.i18n',
  62. 'django.template.context_processors.static',
  63. 'django.template.context_processors.csrf',
  64. 'django.contrib.auth.context_processors.auth',
  65. 'django.contrib.messages.context_processors.messages',
  66. 'ccvpn.context_processors.some_settings',
  67. ],
  68. },
  69. },
  70. ]
  71. WSGI_APPLICATION = 'ccvpn.wsgi.application'
  72. LOGIN_URL = 'account:login'
  73. LOGOUT_URL = 'account:logout'
  74. LOGIN_REDIRECT_URL = 'account:index'
  75. LOGOUT_REDIRECT_URL = '/'
  76. PASSWORD_HASHERS = [
  77. 'django.contrib.auth.hashers.PBKDF2PasswordHasher',
  78. 'ccvpn.passwords.LegacyPasswordHasher',
  79. ]
  80. # Database
  81. # https://docs.djangoproject.com/en/1.8/ref/settings/#databases
  82. DATABASES = {
  83. 'default': {
  84. 'ENGINE': 'django.db.backends.sqlite3',
  85. 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
  86. }
  87. }
  88. # Internationalization
  89. # https://docs.djangoproject.com/en/1.8/topics/i18n/
  90. LANGUAGE_CODE = 'en'
  91. TIME_ZONE = 'UTC'
  92. USE_I18N = True
  93. USE_L10N = True
  94. USE_TZ = True
  95. LANGUAGES = (
  96. ('fr', "French"),
  97. ('en', "English"),
  98. )
  99. LOCALE_PATHS = (
  100. os.path.join(BASE_DIR, 'locale/'),
  101. )
  102. # Static files (CSS, JavaScript, Images)
  103. # https://docs.djangoproject.com/en/1.8/howto/static-files/
  104. STATIC_URL = '/static/'
  105. STATICFILES_DIRS = (
  106. os.path.join(BASE_DIR, 'static'),
  107. )
  108. # Security
  109. X_FRAME_OPTIONS = 'SAMEORIGIN'
  110. SESSION_COOKIE_SECURE = False
  111. CSRF_COOKIE_SECURE = False
  112. CSRF_COOKIE_HTTPONLY = True
  113. SECURE_CONTENT_TYPE_NOSNIFF = True
  114. SECURE_BROWSER_XSS_FILTER = True
  115. SECURE_SSL_REDIRECT = False
  116. SECURE_HSTS_SECONDS = 3600
  117. SECURE_HSTS_INCLUDE_SUBDOMAINS = True
  118. # Enable Discourse SSO
  119. DISCOURSE_SSO = False
  120. DISCOURSE_SECRET = '...'
  121. DISCOURSE_URL = 'https://forum.ccrypto.org/'
  122. # OpenVPN CA Certificate
  123. with open(BASE_DIR + '/ccvpn/ca.crt') as ca_file:
  124. OPENVPN_CA = ca_file.read()
  125. # HTML added before </head>
  126. ADDITIONAL_HEADER_HTML = ''
  127. # HTML added before </body>
  128. ADDITIONAL_HTML = ''
  129. # Will replace the default contact us thing when not empty
  130. SUPPORT_HTML = ''
  131. # Custom per cluster message displayed config page
  132. # 'cluster_name': "No P2P"
  133. LAMBDAINST_CLUSTER_MESSAGES = {}
  134. # Name used in ticket emails
  135. TICKETS_SITE_NAME = 'CCrypto VPN Support'
  136. # Full URL to the site root
  137. ROOT_URL = ''
  138. # Forwarded for header name, if any (None will use remote_addr)
  139. REAL_IP_HEADER_NAME = None
  140. # reCAPTCHA API details. If empty, no captcha is displayed.
  141. RECAPTCHA_API = 'https://www.google.com/recaptcha/api/siteverify'
  142. RECAPTCHA_SITE_KEY = ''
  143. RECAPTCHA_SECRET_KEY = ''
  144. # lcore API settings
  145. LCORE = dict(
  146. BASE_URL='https://core.test.lambdavpn.net/v1/',
  147. API_KEY='',
  148. API_SECRET='',
  149. INST_SECRET='',
  150. CACHE_TTL=600,
  151. TIMEOUT=5,
  152. # SOURCE_ADDR='',
  153. )
  154. # VPN auth credentials and expiration time storage
  155. # - if 'core', password and expiration_date will be replicated to core and
  156. # auth will be done from there.
  157. # - if 'inst', both will be kept here and core should call the API here to
  158. # authenticate users.
  159. # 'core' is faster and doesn't depend on the instance's stability, 'inst'
  160. # lets you generate client_config dynamically.
  161. # /!\ don't use 'core' with unit tests for now.
  162. VPN_AUTH_STORAGE = 'inst'
  163. # Payment & Trial
  164. # Payment backends. See payments/backends.py for more infos.
  165. PAYMENTS_BACKENDS = {
  166. 'bitcoin': {
  167. 'enabled': False,
  168. 'url': 'http://test:test@127.0.0.1:18332/',
  169. # 'chain': '', # mainnet, testnet, regnet
  170. },
  171. 'paypal': {
  172. 'enabled': False,
  173. 'test': True, # Sandbox
  174. # 'api_base': '',
  175. 'address': '', # PayPal address to send to
  176. # 'receiver': '', # PayPal primary address if different
  177. # 'currency': 'EUR',
  178. # 'header_image': '',
  179. },
  180. 'stripe': {
  181. 'enabled': False,
  182. 'secret_key': '',
  183. 'public_key': '',
  184. 'currency': 'EUR',
  185. # 'title': '',
  186. # 'header_image': '',
  187. },
  188. 'coingate': {
  189. 'enabled': False,
  190. # 'sandbox': True,
  191. # 'api_base': '',
  192. 'api_token': '',
  193. 'currency': 'EUR',
  194. # 'title': '',
  195. },
  196. }
  197. PAYMENTS_CURRENCY = ('eur', '€')
  198. CONSTANCE_BACKEND = 'constance.backends.database.DatabaseBackend'
  199. CONSTANCE_CONFIG = {
  200. 'MOTD': ('', "Public site message, displayed on homepage"),
  201. 'MOTD_USER': ('', "Message for users, displayed on account home"),
  202. 'MONTHLY_PRICE_EUR': (300, "Base subscription price per month (x0.01€)"),
  203. 'BTC_EUR_VALUE': (300000, "Current value of a bitcoin (x0.01€/btc)"),
  204. 'TRIAL_PERIOD_HOURS': (2, "Hours given for each trial period"),
  205. 'TRIAL_PERIOD_MAX': (84, "Maximum number of trial periods to give (84*2h=1w)"),
  206. 'NOTIFY_DAYS_BEFORE': ("3, 1", "When to send account expiration notifications. In number of days before, separated y commas",
  207. 'integer_list'),
  208. }
  209. CONSTANCE_ADDITIONAL_FIELDS = {
  210. 'integer_list': ['django.forms.fields.CharField', {
  211. 'validators': [RegexValidator(r'^([0-9]+[ ,]+)*([0-9]+)?$')],
  212. }],
  213. }
  214. # Local settings
  215. try:
  216. from .local_settings import * # noqa
  217. except ImportError:
  218. pass