Introduced local settings in meow-pay/uncloud django app

This commit is contained in:
ahmadbilalkhalid 2020-02-25 13:09:54 +05:00
parent a72bc142a6
commit c7252cde53
2 changed files with 17 additions and 43 deletions

1
uncloud/.gitignore vendored
View file

@ -1,3 +1,4 @@
db.sqlite3
uncloud/secrets.py
debug.log
uncloud/local_settings.py

View file

@ -12,18 +12,26 @@ https://docs.djangoproject.com/en/3.0/ref/settings/
import os
import stripe
import ldap
# Uncommitted file with secrets
import uncloud.secrets
import stripe
import ldap
import uncloud.secrets as secrets
from django_auth_ldap.config import LDAPSearch
# Uncommitted file with local settings i.e logging
try:
from uncloud.local_settings import LOGGING, DATABASES
except ModuleNotFoundError:
LOGGING = {}
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': uncloud.secrets.POSTGRESQL_DB_NAME,
}
}
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
@ -88,8 +96,6 @@ TEMPLATES = [
WSGI_APPLICATION = 'uncloud.wsgi.application'
# Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
@ -167,37 +173,4 @@ USE_TZ = True
STATIC_URL = '/static/'
stripe.api_key = secrets.STRIPE_KEY
# FIXME: not sure if we really need this
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': 'debug.log',
},
},
'loggers': {
'django': {
'handlers': ['file'],
'level': 'DEBUG',
'propagate': True,
},
'django_auth_ldap': {
'handlers': ['file'],
'level': 'DEBUG',
'propagate': True
}
},
}
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': uncloud.secrets.POSTGRESQL_DB_NAME,
}
}
stripe.api_key = uncloud.secrets.STRIPE_KEY