Skip to content
Snippets Groups Projects
Select Git revision
  • 25d15636c301e1e951895da729141dff33593ede
  • master default protected
2 results

local_settings_prod.py

Blame
  • local_settings_prod.py 1.61 KiB
    # noinspection PyUnresolvedReferences
    from heyheyLibrary.settings import *
    import os
    
    # temporary fix for django-countries
    from django_countries.widgets import LazyChoicesMixin
    LazyChoicesMixin.get_choices = lambda self: self._choices
    LazyChoicesMixin.choices = property(LazyChoicesMixin.get_choices, LazyChoicesMixin.set_choices)
    
    
    DATABASES = {
        "default": {
            "ENGINE": os.environ.get("SQL_ENGINE", "django.db.backends.sqlite3"),
            "NAME": os.environ.get("SQL_DATABASE", BASE_DIR / "db.sqlite3"),
            "USER": os.environ.get("SQL_USER", "user"),
            "PASSWORD": os.environ.get("SQL_PASSWORD", "password"),
            "HOST": os.environ.get("SQL_HOST", "localhost"),
            "PORT": os.environ.get("SQL_PORT", "5432"),
        }
    }
    
    
    SECRET_KEY = os.environ.get("SECRET_KEY")
    
    DEBUG = bool(int(os.environ.get("DEBUG", default=0)))
    
    # 'DJANGO_ALLOWED_HOSTS' should be a single string of hosts with a space between each.
    # For example: 'DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1]'
    ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS").split(" ")
    
    CSRF_TRUSTED_ORIGINS = ["http://localhost:1337"]
    
    
    STATIC_URL = "/static/"
    STATIC_ROOT = BASE_DIR / "staticfiles"
    
    MEDIA_URL = "/media/"
    MEDIA_ROOT = BASE_DIR / "mediafiles"
    
    OPENSEARCH_DSL = {
        'default': {
            'hosts': os.environ.get("OPENSEARCH_HOST", "localhost:9200"),
            'use_ssl': True,
            'verify_certs': False,
            'http_auth': (
                os.environ.get("OPENSEARCH_USERNAME", "admin"),
                os.environ.get("OPENSEARCH_PASSWORD", "admin"),
            ),
        }
    }
    
    GOOGLEAPIS_BASE_URL = os.environ.get("GOOGLEAPIS_URL_OVERRIDE", GOOGLEAPIS_BASE_URL)