settings.py 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. """
  2. Django settings for desecapi project.
  3. For more information on this file, see
  4. https://docs.djangoproject.com/en/1.7/topics/settings/
  5. For the full list of settings and their values, see
  6. https://docs.djangoproject.com/en/1.7/ref/settings/
  7. """
  8. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  9. import os
  10. BASE_DIR = os.path.dirname(os.path.dirname(__file__))
  11. # Quick-start development settings - unsuitable for production
  12. # See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
  13. # SECURITY WARNING: keep the secret key used in production secret!
  14. SECRET_KEY = 'lk*42u45uy9dg8l+o9$x56&%_@+85u+20#m82+f8r#w_*cj483'
  15. # SECURITY WARNING: don't run with debug turned on in production!
  16. DEBUG = False
  17. ALLOWED_HOSTS = []
  18. # Application definition
  19. INSTALLED_APPS = (
  20. 'django.contrib.admin',
  21. 'django.contrib.auth',
  22. 'django.contrib.contenttypes',
  23. 'django.contrib.sessions',
  24. 'django.contrib.messages',
  25. 'django.contrib.staticfiles',
  26. 'rest_framework',
  27. 'rest_framework.authtoken',
  28. 'djoser',
  29. 'desecapi',
  30. )
  31. MIDDLEWARE_CLASSES = (
  32. 'django.contrib.sessions.middleware.SessionMiddleware',
  33. 'django.middleware.common.CommonMiddleware',
  34. 'django.middleware.csrf.CsrfViewMiddleware',
  35. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  36. 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
  37. 'django.contrib.messages.middleware.MessageMiddleware',
  38. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  39. )
  40. ROOT_URLCONF = 'desecapi.urls'
  41. WSGI_APPLICATION = 'desecapi.wsgi.application'
  42. # Database
  43. # https://docs.djangoproject.com/en/1.7/ref/settings/#databases
  44. DATABASES = {
  45. 'default': {
  46. # 'ENGINE': 'django.db.backends.sqlite3',
  47. # 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
  48. 'ENGINE': 'django.db.backends.mysql',
  49. 'NAME': '',
  50. 'USER': '',
  51. 'PASSWORD': '',
  52. 'HOST': '127.0.0.1',
  53. 'CHARSET': 'utf8mb4',
  54. 'TEST': {
  55. 'CHARSET': 'utf8mb4',
  56. },
  57. 'OPTIONS': {
  58. 'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
  59. }
  60. },
  61. }
  62. # Internationalization
  63. # https://docs.djangoproject.com/en/1.7/topics/i18n/
  64. LANGUAGE_CODE = 'en-us'
  65. TIME_ZONE = 'UTC'
  66. USE_I18N = True
  67. USE_L10N = True
  68. USE_TZ = True
  69. # Static files (CSS, JavaScript, Images)
  70. # https://docs.djangoproject.com/en/1.7/howto/static-files/
  71. STATIC_URL = '/api/static/'
  72. REST_FRAMEWORK = {
  73. 'DEFAULT_AUTHENTICATION_CLASSES': (
  74. 'rest_framework.authentication.TokenAuthentication',
  75. ),
  76. }
  77. # user management configuration
  78. DJOSER = {
  79. 'DOMAIN': 'desec.io',
  80. 'SITE_NAME': 'deSEC',
  81. 'PASSWORD_RESET_CONFIRM_URL': '#/password/reset/confirm/{uid}/{token}',
  82. 'ACTIVATION_URL': '#/activate/{uid}/{token}',
  83. 'LOGIN_AFTER_ACTIVATION': True,
  84. 'SEND_ACTIVATION_EMAIL': False,
  85. }
  86. TEMPLATES = [
  87. {
  88. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  89. 'DIRS': [],
  90. 'APP_DIRS': True,
  91. 'OPTIONS': {
  92. 'context_processors': [
  93. 'django.template.context_processors.debug',
  94. 'django.template.context_processors.request',
  95. 'django.contrib.auth.context_processors.auth',
  96. 'django.contrib.messages.context_processors.messages',
  97. ],
  98. },
  99. },
  100. ]
  101. # How to send mail
  102. EMAIL_HOST = ''
  103. EMAIL_HOST_USER = ''
  104. EMAIL_HOST_PASSWORD = ''
  105. EMAIL_PORT = ''
  106. DEFAULT_FROM_EMAIL = 'deSEC.io <support@desec.io>'
  107. # use our own user model
  108. AUTH_USER_MODEL = 'desecapi.User'
  109. # Import local settings
  110. from .settings_local import *