diff --git a/uncloud/.gitignore b/uncloud/.gitignore index 4ade18f..71202e1 100644 --- a/uncloud/.gitignore +++ b/uncloud/.gitignore @@ -1,3 +1,4 @@ db.sqlite3 uncloud/secrets.py -debug.log \ No newline at end of file +debug.log +uncloud/local_settings.py \ No newline at end of file diff --git a/uncloud/uncloud/settings.py b/uncloud/uncloud/settings.py index 5ce8e92..e8530e7 100644 --- a/uncloud/uncloud/settings.py +++ b/uncloud/uncloud/settings.py @@ -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