Add favicons and secret settings import.

This commit is contained in:
Stephan Porada 2019-06-18 16:20:11 +02:00
parent d71bed2a3c
commit cd8f6354fe
11 changed files with 40 additions and 6 deletions

2
.gitignore vendored
View File

@ -13,3 +13,5 @@ postgres_data/*
static_volume/*
!**/.gitkeep
secrets.json

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 467 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 938 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1 @@
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}

View File

@ -24,6 +24,10 @@ Also all needes JavaScript and CSS is laoded here.-->
{% else %}
<title>Bundesdata</title>
{% endif %}
<link rel="apple-touch-icon" sizes="180x180" href="{% static "blog/images/favicon/apple-touch-icon.png" %}">
<link rel="icon" type="image/png" sizes="32x32" href="{% static "blog/images/favicon/favicon-32x32.png" %}">
<link rel="icon" type="image/png" sizes="16x16" href="{% static "blog/images/favicon/favicon-16x16.png" %}">
<link rel="manifest" href="{% static "blog/images/favicon/site.webmanifest" %}>
</head>
<body class="blue-grey lighten-5">

View File

@ -10,23 +10,43 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import json
import os
from django.core.exceptions import ImproperlyConfigured
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Loads json files with secrets. Follow this example to create your own secrets
# file with SECRET_KEY and other information.
# Example https://stackoverflow.com/a/42077576
with open(os.path.join(BASE_DIR, 'secrets.json')) as secrets_file:
secrets = json.load(secrets_file)
def get_secret(setting, secrets=secrets):
"""Get secret setting or fail with ImproperlyConfigured"""
try:
return secrets[setting]
except KeyError:
raise ImproperlyConfigured("Set the {} setting".format(setting))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
# This is just some random genearted key to test the App. If you want to set up your own running public version of this app replace this key with an new one that you will keep secret!
SECRET_KEY = '=7n(1!he%todz-)jo))$upf0(vor9v9ke5rn&fli%6l562!_=0'
# This is just some random genearted key to test the App. If you want to set up
# your own running public version of this app replace this key with an new one
# that you will keep secret!
SECRET_KEY = get_secret("SECRET_KEY")
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ["127.0.0.1", "localhost"]
ALLOWED_HOSTS = ["127.0.0.1", "localhost", ]
# Application definition
@ -82,13 +102,15 @@ WSGI_APPLICATION = 'bundesdata_app.wsgi.application'
# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
# Changes NAME, USER and PASSWORD details before deploying your own public version of this app.
# Change NAME, USER and PASSWORD details before deploying your own public
# version of this app. Or use your onw secrets.json file. Explanation found can
# be foudn here: https://stackoverflow.com/a/42077576
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'databaseName',
'USER': 'databaseUserName',
'PASSWORD': 'totalSecurePassword',
'USER': get_secret("DB_USER"),
'PASSWORD': get_secret("DB_PASSWORD"),
'HOST': 'db',
'PORT': '5432',
}

5
app/secrets_example.json Normal file
View File

@ -0,0 +1,5 @@
{
"SECRET_KEY": "=7n(1!he%todz-)jo))$upf0(vor9v9ke5rn&fli%6l562!_=0",
"DB_PASSWORD": "v3ry53cr3t"
"DB_USER": "bundesdata_app_user"
}