settings.py 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. # -*- coding: utf-8 -*-
  2. from __future__ import unicode_literals
  3. from decouple import RepositoryEnv, Config, Csv
  4. from corsheaders.defaults import default_headers
  5. import os
  6. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  7. CONFIG = Config(RepositoryEnv(os.path.join(BASE_DIR, 'data', '.env')))
  8. INSTALLED_APPS = [
  9. 'django.contrib.admin',
  10. 'django.contrib.auth',
  11. 'django.contrib.contenttypes',
  12. 'django.contrib.sessions',
  13. 'django.contrib.messages',
  14. 'django.contrib.staticfiles',
  15. 'django_extensions',
  16. 'tastypie',
  17. 'core.apps.CoreConfig',
  18. 'api.apps.ApiConfig',
  19. 'ui.apps.UiConfig',
  20. 'corsheaders',
  21. ]
  22. MIDDLEWARE = [
  23. 'corsheaders.middleware.CorsMiddleware',
  24. 'django.middleware.security.SecurityMiddleware',
  25. 'whitenoise.middleware.WhiteNoiseMiddleware',
  26. 'django.contrib.sessions.middleware.SessionMiddleware',
  27. 'django.middleware.common.CommonMiddleware',
  28. 'django.middleware.csrf.CsrfViewMiddleware',
  29. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  30. 'django.contrib.messages.middleware.MessageMiddleware',
  31. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  32. ]
  33. ROOT_URLCONF = 'odoo_control.urls'
  34. TEMPLATES = [
  35. {
  36. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  37. 'DIRS': [],
  38. 'APP_DIRS': True,
  39. 'OPTIONS': {
  40. 'context_processors': [
  41. 'django.template.context_processors.debug',
  42. 'django.template.context_processors.request',
  43. 'django.contrib.auth.context_processors.auth',
  44. 'django.contrib.messages.context_processors.messages',
  45. ],
  46. },
  47. },
  48. ]
  49. WSGI_APPLICATION = 'odoo_control.wsgi.application'
  50. DATABASES = {
  51. 'default': {
  52. 'ENGINE': 'django.db.backends.sqlite3',
  53. 'NAME': os.path.join(BASE_DIR, 'data/app.db'),
  54. }
  55. }
  56. AUTH_PASSWORD_VALIDATORS = [
  57. {
  58. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  59. },
  60. {
  61. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  62. },
  63. {
  64. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  65. },
  66. {
  67. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  68. },
  69. ]
  70. # AUTH_USER_MODEL = 'core.User'
  71. LANGUAGE_CODE = 'es-PY'
  72. TIME_ZONE = 'UTC'
  73. USE_I18N = True
  74. USE_L10N = True
  75. USE_TZ = True
  76. STATIC_URL = '/static/'
  77. STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
  78. STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
  79. TASTYPIE_DEFAULT_FORMATS = ['json', 'xml']
  80. SECRET_KEY = CONFIG('SECRET_KEY')
  81. ALLOWED_HOSTS = CONFIG('ALLOWED_HOSTS', cast=Csv())
  82. CORS_ORIGIN_ALLOW_ALL = CONFIG('DEBUG', default=False, cast=bool)
  83. CORS_ALLOW_CREDENTIALS = True
  84. DEBUG = CONFIG('DEBUG', default=False, cast=bool)
  85. EMAIL_HOST = CONFIG('EMAIL_HOST', 'localhost')
  86. EMAIL_PORT = CONFIG('EMAIL_PORT', 25)
  87. EMAIL_HOST_USER = CONFIG('EMAIL_HOST_USER')
  88. EMAIL_HOST_PASSWORD = CONFIG('EMAIL_HOST_PASSWORD')
  89. EMAIL_USE_SSL = CONFIG('EMAIL_USE_SSL', cast=bool)
  90. SEND_EMAIL = CONFIG('SEND_EMAIL', cast=bool)
  91. EMAIL_FROM = CONFIG('EMAIL_FROM')
  92. SYSTEM_NAME = CONFIG('SYSTEM_NAME')
  93. JWT_ACCEPT_HEADER = CONFIG('JWT_ACCEPT_HEADER')
  94. JWT_PREFIX_HEADER = CONFIG('JWT_PREFIX_HEADER')
  95. JWT_SECRET_KEY = CONFIG('JWT_SECRET_KEY')
  96. EXTERNAL_IP = CONFIG('EXTERNAL_IP')
  97. INTERNAL_IP = CONFIG('INTERNAL_IP')
  98. INTERNAL_NETWORK_NAME = CONFIG('INTERNAL_NETWORK_NAME', 'default')
  99. DOCKER_SOCK_DIR = CONFIG('DOCKER_SOCK_DIR')
  100. DOCKER_FILTERS = CONFIG('DOCKER_FILTERS', cast=Csv())
  101. ODOO_IMAGE = CONFIG('ODOO_IMAGE')
  102. ODOO_ROOT_PATH = CONFIG('ODOO_ROOT_PATH')
  103. ODOO_DEFAULT_FOLDERS = CONFIG('ODOO_DEFAULT_FOLDERS', cast=lambda x: dict([s.split(':') for s in x.split(',')]))
  104. ODOO_PORTS_RANGE = CONFIG('ODOO_PORTS_RANGE', cast=Csv(int))
  105. ODOO_CONF_FILENAME = CONFIG('ODOO_CONF_FILENAME', 'openerp-server')
  106. ODOO_ADMIN_PASSWORD = CONFIG('ODOO_ADMIN_PASSWORD', 'admin')
  107. ODOO_DB_CONTAINER = CONFIG('ODOO_DB_CONTAINER', 'postgres')
  108. ODOO_DB_HOST = CONFIG('ODOO_DB_HOST', 'localhost')
  109. ODOO_DB_PORT = CONFIG('ODOO_DB_PORT', default=5432, cast=int)
  110. ODOO_DB_USER = CONFIG('ODOO_DB_USER', 'postgres')
  111. ODOO_DB_PASSWORD = CONFIG('ODOO_DB_PASSWORD', 'root')
  112. GIT_PATH = CONFIG('GIT_PATH')