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.
 
 
 
 
 
 

261 lines
6.9 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. 'constance',
  33. 'constance.backends.database',
  34. )
  35. MIDDLEWARE_CLASSES = (
  36. 'django.contrib.sessions.middleware.SessionMiddleware',
  37. 'django.middleware.common.CommonMiddleware',
  38. 'django.middleware.common.BrokenLinkEmailsMiddleware',
  39. 'django.middleware.csrf.CsrfViewMiddleware',
  40. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  41. 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
  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. PAGES_DIR = BASE_DIR + '/pages/'
  77. PASSWORD_HASHERS = [
  78. 'django.contrib.auth.hashers.PBKDF2PasswordHasher',
  79. 'ccvpn.passwords.LegacyPasswordHasher',
  80. ]
  81. # Database
  82. # https://docs.djangoproject.com/en/1.8/ref/settings/#databases
  83. DATABASES = {
  84. 'default': {
  85. 'ENGINE': 'django.db.backends.sqlite3',
  86. 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
  87. }
  88. }
  89. # Internationalization
  90. # https://docs.djangoproject.com/en/1.8/topics/i18n/
  91. LANGUAGE_CODE = 'en'
  92. TIME_ZONE = 'UTC'
  93. USE_I18N = True
  94. USE_L10N = True
  95. USE_TZ = True
  96. LANGUAGES = (
  97. ('fr', "French"),
  98. ('en', "English"),
  99. )
  100. LOCALE_PATHS = (
  101. os.path.join(BASE_DIR, 'locale/'),
  102. )
  103. # Static files (CSS, JavaScript, Images)
  104. # https://docs.djangoproject.com/en/1.8/howto/static-files/
  105. STATIC_URL = '/static/'
  106. STATICFILES_DIRS = (
  107. os.path.join(BASE_DIR, 'static'),
  108. )
  109. # Security
  110. X_FRAME_OPTIONS = 'SAMEORIGIN'
  111. SESSION_COOKIE_SECURE = False
  112. CSRF_COOKIE_SECURE = False
  113. CSRF_COOKIE_HTTPONLY = True
  114. SECURE_CONTENT_TYPE_NOSNIFF = True
  115. SECURE_BROWSER_XSS_FILTER = True
  116. SECURE_SSL_REDIRECT = False
  117. SECURE_HSTS_SECONDS = 3600
  118. SECURE_HSTS_INCLUDE_SUBDOMAINS = True
  119. # Enable Discourse SSO
  120. DISCOURSE_SSO = False
  121. DISCOURSE_SECRET = '...'
  122. DISCOURSE_URL = 'https://forum.ccrypto.org/'
  123. # OpenVPN CA Certificate
  124. with open(BASE_DIR + '/ccvpn/ca.crt') as ca_file:
  125. OPENVPN_CA = ca_file.read()
  126. # HTML added before </head>
  127. ADDITIONAL_HEADER_HTML = ''
  128. # HTML added before </body>
  129. ADDITIONAL_HTML = ''
  130. # Custom per cluster message displayed config page
  131. # 'cluster_name': "No P2P"
  132. LAMBDAINST_CLUSTER_MESSAGES = {}
  133. # Name used in ticket emails
  134. TICKETS_SITE_NAME = 'CCrypto VPN Support'
  135. # Full URL to the site root
  136. ROOT_URL = ''
  137. # Forwarded for header name, if any (None will use remote_addr)
  138. REAL_IP_HEADER_NAME = None
  139. # reCAPTCHA API details. If empty, no captcha is displayed.
  140. RECAPTCHA_API = 'https://www.google.com/recaptcha/api/siteverify'
  141. RECAPTCHA_SITE_KEY = ''
  142. RECAPTCHA_SECRET_KEY = ''
  143. # lcore API settings
  144. LCORE = dict(
  145. BASE_URL='https://core.test.lambdavpn.net/v1/',
  146. API_KEY='',
  147. API_SECRET='',
  148. INST_SECRET='',
  149. CACHE_TTL=10,
  150. )
  151. # VPN auth credentials and expiration time storage
  152. # - if 'core', password and expiration_date will be replicated to core and
  153. # auth will be done from there.
  154. # - if 'inst', both will be kept here and core should call the API here to
  155. # authenticate users.
  156. # 'core' is faster and doesn't depend on the instance's stability, 'inst'
  157. # lets you generate client_config dynamically.
  158. # /!\ don't use 'core' with unit tests for now.
  159. VPN_AUTH_STORAGE = 'inst'
  160. # Payment & Trial
  161. # Payment backends. See payments/backends.py for more infos.
  162. PAYMENTS_BACKENDS = {
  163. 'paypal': {
  164. 'TEST': True, # Sandbox
  165. 'ADDRESS': 'paypal@ccrypto.org', # Your PayPal primary address
  166. },
  167. # Remove the leading '_' to enable these backends.
  168. '_stripe': {
  169. 'API_KEY': '',
  170. 'PUBLIC_KEY': '',
  171. },
  172. '_bitcoin': {
  173. 'URL': 'http://test:test@127.0.0.1:18332/',
  174. 'BITCOIN_VALUE': 36000, # Value of one bitcoin in currency*100
  175. },
  176. }
  177. PAYMENTS_CURRENCY = ('eur', '€')
  178. CONSTANCE_BACKEND = 'constance.backends.database.DatabaseBackend'
  179. CONSTANCE_CONFIG = {
  180. 'MOTD': ('', "Public site message, displayed on homepage"),
  181. 'MOTD_USER': ('', "Message for users, displayed on account home"),
  182. 'MONTHLY_PRICE_EUR': (300, "Base subscription price per month (x0.01€)"),
  183. 'BTC_EUR_VALUE': (300000, "Current value of a bitcoin (x0.01€/btc)"),
  184. 'TRIAL_PERIOD_HOURS': (2, "Hours given for each trial period"),
  185. 'TRIAL_PERIOD_MAX': (84, "Maximum number of trial periods to give (84*2h=1w)"),
  186. 'NOTIFY_DAYS_BEFORE': ("3, 1", "When to send account expiration notifications. In number of days before, separated y commas",
  187. 'integer_list'),
  188. }
  189. CONSTANCE_ADDITIONAL_FIELDS = {
  190. 'integer_list': ['django.forms.fields.CharField', {
  191. 'validators': [RegexValidator(r'^([0-9]+[ ,]+)*([0-9]+)?$')],
  192. }],
  193. }
  194. # Local settings
  195. try:
  196. from .local_settings import * # noqa
  197. except ImportError:
  198. pass