settings.py 3.5 KB

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