Пример #1
0
from django.contrib.messages import constants as messages
from django.core.urlresolvers import reverse_lazy

from deployutils.configs import load_config, update_settings

#pylint: disable=undefined-variable

APP_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
APP_NAME = os.path.basename(APP_ROOT)
BASE_DIR = APP_ROOT

SLUG_RE = '[a-zA-Z0-9-]+'

update_settings(sys.modules[__name__],
    load_config(APP_NAME, 'credentials', 'site.conf', verbose=True,
        location=os.getenv("SETTINGS_LOCATION", None),
        passphrase=os.getenv("SETTINGS_CRYPT_KEY", None)))

if os.getenv('DEBUG'):
    # Enable override on command line.
    DEBUG = True if int(os.getenv('DEBUG')) > 0 else False

DATABASES = {
    'default': {
        'ENGINE':DB_ENGINE,
        'NAME': DB_NAME,
        'USER': DB_USER,                 # Not used with sqlite3.
        'PASSWORD': DB_PASSWORD,         # Not used with sqlite3.
        'HOST': DB_HOST,                 # Not used with sqlite3.
        'PORT': DB_PORT,                 # Not used with sqlite3.
        'TEST_NAME': ':memory:',
Пример #2
0
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

#pylint: disable=undefined-variable
FEATURES_REVERT_TO_DJANGO = False  # XXX 2016-03-31 temporary product switch

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
APP_NAME = os.path.basename(BASE_DIR)

DB_HOST = ''
DB_PORT = 5432
SEND_EMAIL = True
RULES_APP_MODEL = 'djaoapp_extras.App'

update_settings(
    sys.modules[__name__],
    load_config(APP_NAME, 'credentials', 'site.conf', verbose=True))

if os.getenv('DEBUG'):
    # Enable override on command line.
    DEBUG = True if int(os.getenv('DEBUG')) > 0 else False

API_DEBUG = DEBUG

if getattr(sys.modules[__name__], 'RULES_APP_MODEL', None):
    RULES_APPS = (RULES_APP_MODEL.split('.')[0], )
else:
    RULES_APPS = tuple([])

if DEBUG:
    if not FEATURES_REVERT_TO_DJANGO:
        # (Django2.2) We cannot include admin panels because a `check`
Пример #3
0
Django settings for deployutils testsite project.
"""

import os, sys

from deployutils.apps.django.compat import reverse_lazy
from deployutils.configs import load_config, update_settings


# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
APP_NAME = os.path.basename(BASE_DIR)

update_settings(sys.modules[__name__],
    load_config(APP_NAME, 'credentials', 'site.conf', verbose=True,
        location=os.getenv("SETTINGS_LOCATION", None),
        passphrase=os.getenv("SETTINGS_CRYPT_KEY", None)))

if not hasattr(sys.modules[__name__], "SECRET_KEY"):
    from random import choice
    SECRET_KEY = "".join([choice(
        "abcdefghijklmnopqrstuvwxyz0123456789!@#$%^*-_=+") for i in range(50)])

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []

# Installed apps
# --------------
if DEBUG: