This commit is contained in:
vabene1111 2018-11-07 13:47:23 +01:00
parent 484f7c556e
commit 9fd3d6e431
4 changed files with 40 additions and 29 deletions

View File

@ -0,0 +1,14 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<value>
<list size="1">
<item index="0" class="java.lang.String" itemvalue="dotenv" />
</list>
</value>
</option>
</inspection_tool>
</profile>
</component>

View File

@ -1,25 +0,0 @@
"""
Setting file for secret settings
imported by settings.py
TEMPLATE FILE: remove .template extension and fill in missing values
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
# defined in secret settings to be able to use local sqlite db's
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = ''
# Database
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}

View File

@ -9,17 +9,22 @@ https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
import os
from django.contrib import messages
from recipes.secret_settings import *
from dotenv import load_dotenv
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
# Get vars from .env files
SECRET_KEY = os.getenv('SECRET_KEY')
ALLOWED_HOSTS = ['192.168.178.27', '127.0.0.1']
DEBUG = bool(int(os.getenv('DEBUG', False)))
ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS').split(',') if os.getenv('ALLOWED_HOSTS') else []
LOGIN_REDIRECT_URL = "index"
LOGOUT_REDIRECT_URL = "index"
@ -79,6 +84,20 @@ TEMPLATES = [
WSGI_APPLICATION = 'recipes.wsgi.application'
# Database
# Load settings from env files
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'HOST': os.getenv('POSTGRES_HOST'),
'PORT': os.getenv('POSTGRES_PORT'),
'USER': os.getenv('POSTGRES_USER'),
'PASSWORD': os.getenv('POSTGRES_PASSWORD'),
'NAME': os.getenv('POSTGRES_DB'),
}
}
# Password validation
# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators

View File

@ -5,4 +5,7 @@ django-tables2
django-filter
django-crispy-forms
djangorestframework
django-autocomplete-light
django-autocomplete-light
python-dotenv==0.7.1
psycopg2==2.7.4
gunicorn==19.7.1