# -*- coding: utf-8 -*- from __future__ import unicode_literals from decouple import RepositoryEnv, Config, Csv from corsheaders.defaults import default_headers import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) CONFIG = Config(RepositoryEnv(os.path.join(BASE_DIR, 'data', '.env'))) INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django_extensions', 'tastypie', 'core.apps.CoreConfig', 'api.apps.ApiConfig', 'ui.apps.UiConfig', 'corsheaders', ] MIDDLEWARE = [ 'corsheaders.middleware.CorsMiddleware', 'django.middleware.security.SecurityMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'odoo_control.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'odoo_control.wsgi.application' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'data/app.db'), } } AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # AUTH_USER_MODEL = 'core.User' LANGUAGE_CODE = 'es-PY' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' TASTYPIE_DEFAULT_FORMATS = ['json', 'xml'] SECRET_KEY = CONFIG('SECRET_KEY') ALLOWED_HOSTS = CONFIG('ALLOWED_HOSTS', cast=Csv()) CORS_ORIGIN_ALLOW_ALL = CONFIG('DEBUG', default=False, cast=bool) CORS_ALLOW_CREDENTIALS = True DEBUG = CONFIG('DEBUG', default=False, cast=bool) EMAIL_HOST = CONFIG('EMAIL_HOST', 'localhost') EMAIL_PORT = CONFIG('EMAIL_PORT', 25) EMAIL_HOST_USER = CONFIG('EMAIL_HOST_USER') EMAIL_HOST_PASSWORD = CONFIG('EMAIL_HOST_PASSWORD') EMAIL_USE_SSL = CONFIG('EMAIL_USE_SSL', cast=bool) SEND_EMAIL = CONFIG('SEND_EMAIL', cast=bool) EMAIL_FROM = CONFIG('EMAIL_FROM') SYSTEM_NAME = CONFIG('SYSTEM_NAME') JWT_ACCEPT_HEADER = CONFIG('JWT_ACCEPT_HEADER') JWT_PREFIX_HEADER = CONFIG('JWT_PREFIX_HEADER') JWT_SECRET_KEY = CONFIG('JWT_SECRET_KEY') EXTERNAL_IP = CONFIG('EXTERNAL_IP') INTERNAL_IP = CONFIG('INTERNAL_IP') INTERNAL_NETWORK_NAME = CONFIG('INTERNAL_NETWORK_NAME', 'default') DOCKER_SOCK_DIR = CONFIG('DOCKER_SOCK_DIR') DOCKER_FILTERS = CONFIG('DOCKER_FILTERS', cast=Csv()) ODOO_IMAGE = CONFIG('ODOO_IMAGE') ODOO_ROOT_PATH = CONFIG('ODOO_ROOT_PATH') ODOO_DEFAULT_FOLDERS = CONFIG('ODOO_DEFAULT_FOLDERS', cast=lambda x: dict([s.split(':') for s in x.split(',')])) ODOO_PORTS_RANGE = CONFIG('ODOO_PORTS_RANGE', cast=Csv(int)) ODOO_CONF_FILENAME = CONFIG('ODOO_CONF_FILENAME', 'openerp-server') ODOO_ADMIN_PASSWORD = CONFIG('ODOO_ADMIN_PASSWORD', 'admin') ODOO_DB_CONTAINER = CONFIG('ODOO_DB_CONTAINER', 'postgres') ODOO_DB_HOST = CONFIG('ODOO_DB_HOST', 'localhost') ODOO_DB_PORT = CONFIG('ODOO_DB_PORT', default=5432, cast=int) ODOO_DB_USER = CONFIG('ODOO_DB_USER', 'postgres') ODOO_DB_PASSWORD = CONFIG('ODOO_DB_PASSWORD', 'root') GIT_PATH = CONFIG('GIT_PATH')