예제 #1
0
# import the general settings for the project
from django_project.settings.common import *
from django_project.settings.logging import *
import logging

logger = logging.getLogger(__name__)
PDB_DEBUG = True if os.getenv("PDB_DEBUG") else False

SECRET_KEY = os.getenv("DJANGO_SECRET_KEY", "PlsChgMe")

# configure database settings
DATABASE_NAME = os.getenv("PDB_DATABASE_NAME", "productdb_dev")
DATABASE_USER = os.getenv("PDB_DATABASE_USER", "productdb")
DATABASE_PASSWORD = os.getenv("PDB_DATABASE_PASSWORD", "productdb")
DATABASE_HOST = os.getenv("PDB_DATABASE_HOST", "127.0.0.1")
DATABASE_PORT = os.getenv("PDB_DATABASE_PORT", "5432")

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': DATABASE_NAME,
        'USER': DATABASE_USER,
        'PASSWORD': DATABASE_PASSWORD,
        'HOST': DATABASE_HOST,
        'PORT': DATABASE_PORT
    }
}

if PDB_DEBUG:
    DEBUG = True
    ALLOWED_HOSTS = []
예제 #2
0
# import the general settings for the project
from django_project.settings.common import *
from django_project.settings.logging import *
import logging

logger = logging.getLogger(__name__)

try:
    # read secret key
    keyfile = os.path.join(BASE_DIR, "..", "..", "secret_key.key")
    if os.path.exists(keyfile):
        f = open(keyfile)
        SECRET_KEY = f.read()
    else:
        SECRET_KEY = "PlsChgMe"

except:
    SECRET_KEY = "PlsChgMe"
    logger.error("Django CONFIG: Default secret key not reconfigured, use '%s'" % SECRET_KEY)

# include production configuration (if available)
try:
    # deploy configuration requires a postgres server environment
    from django_project.settings.deploy import *

    SECURE_CONTENT_TYPE_NOSNIFF = True
    SECURE_BROWSER_XSS_FILTER = True

except:
    logger.warn("Django CONFIG: Deploy configuration not found, use development configuration")
예제 #3
0
# import the general settings for the project
from django_project.settings.common import *
from django_project.settings.logging import *
import logging

logger = logging.getLogger(__name__)
PDB_DEBUG = True if os.getenv("PDB_DEBUG") else False

SECRET_KEY = os.getenv("DJANGO_SECRET_KEY", "PlsChgMe")

# configure database settings
DATABASE_NAME = os.getenv("PDB_DATABASE_NAME", "productdb_dev")
DATABASE_USER = os.getenv("PDB_DATABASE_USER", "productdb")
DATABASE_PASSWORD = os.getenv("PDB_DATABASE_PASSWORD", "productdb")
DATABASE_HOST = os.getenv("PDB_DATABASE_HOST", "127.0.0.1")
DATABASE_PORT = os.getenv("PDB_DATABASE_PORT", "5432")

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': DATABASE_NAME,
        'USER': DATABASE_USER,
        'PASSWORD': DATABASE_PASSWORD,
        'HOST': DATABASE_HOST,
        'PORT': DATABASE_PORT
    }
}

if PDB_DEBUG:
    DEBUG = True
    ALLOWED_HOSTS = []