0% found this document useful (0 votes)
29 views

Message

This document contains Django settings configuration including database configuration using environment variables, static and media file paths, email configuration using SendGrid, social authentication keys, logging configuration, and other miscellaneous settings. Paths are built relative to the base project directory and settings have default values if environment variables are not set.

Uploaded by

diego
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Message

This document contains Django settings configuration including database configuration using environment variables, static and media file paths, email configuration using SendGrid, social authentication keys, logging configuration, and other miscellaneous settings. Paths are built relative to the base project directory and settings have default values if environment variables are not set.

Uploaded by

diego
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)


BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DATA_DIR = os.path.dirname(os.path.dirname(__file__))
DATA_DIR = DATA_DIR + "/../"

# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
DEBUG = True

SECRET_KEY = os.environ.get("SECRET_KEY", "z6r_8she(=((91m%vl0pb0j=rh+g1@^06-l!


tggune17kmh-(@")

ALLOWED_HOSTS = ['*']

DATABASES = {
'default': {
"ENGINE": os.environ.get("SQL_ENGINE", "django.db.backends.sqlite3"),
"NAME": os.environ.get("SQL_DATABASE", os.path.join(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"),
}
}

GEOIP_PATH = os.environ.get("GEOIP_PATH", "")


DOMAIN = os.environ.get("DOMAIN", "http://localhost:8080")

# Static and Media files (CSS, JavaScript, Images)


# https://docs.djangoproject.com/en/1.11/howto/static-files/

STATIC_URL = '/static/'
MEDIA_URL = '/media/'

STATIC_ROOT = os.path.join(DATA_DIR, 'static/')


MEDIA_ROOT = os.path.join(DATA_DIR, 'media')

STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'website', 'static'),
)

# Config for password recovery


SENDGRID_KEY = os.environ.get("SENDGRID_KEY", "")
SENDGRID_DEFAULT_SENDER = "[email protected]"

EMAIL_HOST = 'smtp.sendgrid.net'
#EMAIL_PORT = 465
EMAIL_HOST_USER = 'apikey'
EMAIL_HOST_PASSWORD = SENDGRID_KEY
#EMAIL_USE_SSL = True

SOCIAL_AUTH_FACEBOOK_KEY = os.environ.get("SOCIAL_AUTH_FACEBOOK_KEY", "")


SOCIAL_AUTH_FACEBOOK_SECRET = os.environ.get("SOCIAL_AUTH_FACEBOOK_SECRET", "")

NETPAY_ORG_ID = '45ssiuz3' # sandbox


NETPAY_MERCHANT_ID = 'netpaymx_retail'
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '{levelname} {asctime} {module} {process:d} {thread:d}
{message}',
'style': '{',
},
'simple': {
'format': '{levelname} {message}',
'style': '{',
},
},
'handlers': {
'file': {
'level': 'INFO',
'class': 'logging.handlers.RotatingFileHandler',
'filename': os.environ.get("LOGGER_FILENAME",
"/tmp/payment_logger.log"),
'formatter': 'verbose',
'maxBytes': 1024 * 1024 * 25, # 25MB
'backupCount': 10,
},
},
'loggers': {
'payments.card_transactions': {
'handlers': ['file'],
'level': 'INFO',
'propagate': True,
},
},
}

You might also like