mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 03:17:07 +00:00
[FEAT] Isolate settings from image build and allow PWA customisation
Settings can now be changed without rebuilding the image PWA settings can now be changed
This commit is contained in:
@@ -13,8 +13,8 @@ Before production deployment, see
|
|||||||
https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
|
https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
|
||||||
Many configuration settings are input from `settings.ini`.
|
Many configuration settings are input from `.env`.
|
||||||
The most likely required settings are: SECRET_KEY, DEBUG, ALLOWED_HOSTS, DATABASE_URL, PROJECT_*_NAME, EMAIL_*
|
The most likely required settings are: SECRET_KEY, DEBUG, ALLOWED_HOSTS, PROJECT_*_NAME, EMAIL_*
|
||||||
|
|
||||||
- SECRET_KEY (REQUIRED)
|
- SECRET_KEY (REQUIRED)
|
||||||
Used to generate CSRF tokens - must never be made public
|
Used to generate CSRF tokens - must never be made public
|
||||||
@@ -33,24 +33,28 @@ The most likely required settings are: SECRET_KEY, DEBUG, ALLOWED_HOSTS, DATABAS
|
|||||||
|
|
||||||
- PROJECT_LONG_NAME
|
- PROJECT_LONG_NAME
|
||||||
default: Project Network Mapper
|
default: Project Network Mapper
|
||||||
The project's full name
|
The project's full name.
|
||||||
|
|
||||||
- PROJECT_SHORT_NAME
|
- PROJECT_SHORT_NAME
|
||||||
default: Network Mapper
|
default: Network Mapper
|
||||||
The project's short/abbreviated name.
|
The project's short/abbreviated name. This will also be used as the app's name when installed as PWA.
|
||||||
|
|
||||||
- PROJECT_THEME_COLOR
|
- PROJECT_DESCRIPTION
|
||||||
|
default: Application to map network relationships in the organisation.
|
||||||
|
The project's description. Used when installed as a PWA.
|
||||||
|
|
||||||
|
- THEME_COLOR
|
||||||
default: 212121
|
default: 212121
|
||||||
The project's theme color, in hex format (excluding the leading #).
|
The project's theme color, in hex format (excluding the leading #).
|
||||||
|
|
||||||
|
- BACKGROUND_COLOR
|
||||||
|
default: ffffff
|
||||||
|
The project's background color, in hex format (excluding the leading #).
|
||||||
|
|
||||||
- ALLOWED_HOSTS
|
- ALLOWED_HOSTS
|
||||||
default: * if DEBUG else localhost
|
default: * if DEBUG else localhost
|
||||||
Accepted values for server header in request - protects against CSRF and CSS attacks
|
Accepted values for server header in request - protects against CSRF and CSS attacks
|
||||||
|
|
||||||
- DATABASE_URL
|
|
||||||
default: sqlite://db.sqlite3
|
|
||||||
URL to database - uses format described at https://github.com/jacobian/dj-database-url
|
|
||||||
|
|
||||||
- DBBACKUP_STORAGE_LOCATION
|
- DBBACKUP_STORAGE_LOCATION
|
||||||
default: .dbbackup
|
default: .dbbackup
|
||||||
Directory where database backups should be stored
|
Directory where database backups should be stored
|
||||||
@@ -129,6 +133,11 @@ SETTINGS_EXPORT = [
|
|||||||
'SITE_URL',
|
'SITE_URL',
|
||||||
'SITE_PROTOCOL',
|
'SITE_PROTOCOL',
|
||||||
'GOOGLE_MAPS_API_KEY',
|
'GOOGLE_MAPS_API_KEY',
|
||||||
|
'PROJECT_LONG_NAME',
|
||||||
|
'PROJECT_SHORT_NAME',
|
||||||
|
'PROJECT_DESCRIPTION',
|
||||||
|
'THEME_COLOR',
|
||||||
|
'BACKGROUND_COLOR',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -237,10 +246,7 @@ WSGI_APPLICATION = 'breccia_mapper.wsgi.application'
|
|||||||
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
|
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
|
||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default':
|
'default': dj_database_url.parse('sqlite:///' + str(BASE_DIR.joinpath('db.sqlite3')))
|
||||||
config('DATABASE_URL',
|
|
||||||
default='sqlite:///' + str(BASE_DIR.joinpath('db.sqlite3')),
|
|
||||||
cast=dj_database_url.parse)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Django DBBackup
|
# Django DBBackup
|
||||||
@@ -392,32 +398,15 @@ CONSTANCE_CONFIG = {
|
|||||||
'RELATIONSHIP_FORM_HELP': (
|
'RELATIONSHIP_FORM_HELP': (
|
||||||
'',
|
'',
|
||||||
'Help text to display at the top of relationship forms.'),
|
'Help text to display at the top of relationship forms.'),
|
||||||
'SITE_ICON': (
|
|
||||||
'icon.png',
|
|
||||||
'Site icon',
|
|
||||||
'image_field'),
|
|
||||||
'SITE_ICON_192x192': (
|
|
||||||
'icon-192x192.png',
|
|
||||||
'Site icon',
|
|
||||||
'image_field'),
|
|
||||||
'PARENT_PROJECT_NAME': (
|
'PARENT_PROJECT_NAME': (
|
||||||
'',
|
'',
|
||||||
'Parent project name'),
|
'Parent project name'),
|
||||||
'PROJECT_LONG_NAME': (
|
|
||||||
'Project Network Mapper',
|
|
||||||
'Project long name'),
|
|
||||||
'PROJECT_SHORT_NAME': (
|
|
||||||
'Network Mapper',
|
|
||||||
'Project short name'),
|
|
||||||
'PROJECT_LEAD': (
|
'PROJECT_LEAD': (
|
||||||
'Project Lead',
|
'Project Lead',
|
||||||
'Project lead'),
|
'Project lead'),
|
||||||
'PROJECT_TAGLINE': (
|
'PROJECT_TAGLINE': (
|
||||||
'Here is your project\'s tagline.',
|
'Here is your project\'s tagline.',
|
||||||
'Project tagline'),
|
'Project tagline'),
|
||||||
'PROJECT_THEME_COLOR': (
|
|
||||||
'#212121',
|
|
||||||
'The hex color code for the project\'s theme color, including the #.'),
|
|
||||||
'HOMEPAGE_HEADER_IMAGE': (
|
'HOMEPAGE_HEADER_IMAGE': (
|
||||||
'800x500.png',
|
'800x500.png',
|
||||||
'Homepage header image',
|
'Homepage header image',
|
||||||
@@ -467,11 +456,8 @@ CONSTANCE_CONFIG = {
|
|||||||
CONSTANCE_CONFIG_FIELDSETS = {
|
CONSTANCE_CONFIG_FIELDSETS = {
|
||||||
'Project options': (
|
'Project options': (
|
||||||
'PARENT_PROJECT_NAME',
|
'PARENT_PROJECT_NAME',
|
||||||
'PROJECT_LONG_NAME',
|
|
||||||
'PROJECT_SHORT_NAME',
|
|
||||||
'PROJECT_LEAD',
|
'PROJECT_LEAD',
|
||||||
'PROJECT_TAGLINE',
|
'PROJECT_TAGLINE',
|
||||||
'PROJECT_THEME_COLOR',
|
|
||||||
),
|
),
|
||||||
'Homepage configuration': (
|
'Homepage configuration': (
|
||||||
'HOMEPAGE_HEADER_IMAGE_SHRINK',
|
'HOMEPAGE_HEADER_IMAGE_SHRINK',
|
||||||
@@ -501,14 +487,16 @@ CONSTANCE_CONFIG_FIELDSETS = {
|
|||||||
'ORGANISATION_LIST_HELP',
|
'ORGANISATION_LIST_HELP',
|
||||||
'RELATIONSHIP_FORM_HELP',
|
'RELATIONSHIP_FORM_HELP',
|
||||||
),
|
),
|
||||||
'Deployment': (
|
|
||||||
'SITE_ICON',
|
|
||||||
'SITE_ICON_192x192',
|
|
||||||
),
|
|
||||||
} # yapf: disable
|
} # yapf: disable
|
||||||
|
|
||||||
CONSTANCE_BACKEND = 'constance.backends.database.DatabaseBackend'
|
CONSTANCE_BACKEND = 'constance.backends.database.DatabaseBackend'
|
||||||
|
|
||||||
|
PROJECT_LONG_NAME = config('PROJECT_LONG_NAME', 'Project Network Mapper')
|
||||||
|
PROJECT_SHORT_NAME = config('PROJECT_SHORT_NAME', 'Network Mapper')
|
||||||
|
PROJECT_DESCRIPTION = config('PROJECT_DESCRIPTION', 'Application to map network relationships in the organisation.')
|
||||||
|
THEME_COLOR = '#' + config('THEME_COLOR', '212121')
|
||||||
|
BACKGROUND_COLOR = '#' + config('BACKGROUND_COLOR', 'ffffff')
|
||||||
|
|
||||||
# Django Hijack settings
|
# Django Hijack settings
|
||||||
# See https://django-hijack.readthedocs.io/en/stable/
|
# See https://django-hijack.readthedocs.io/en/stable/
|
||||||
|
|
||||||
@@ -527,7 +515,7 @@ BOOTSTRAP4 = {
|
|||||||
EMAIL_HOST = config('EMAIL_HOST', default=None)
|
EMAIL_HOST = config('EMAIL_HOST', default=None)
|
||||||
DEFAULT_FROM_EMAIL = config(
|
DEFAULT_FROM_EMAIL = config(
|
||||||
'DEFAULT_FROM_EMAIL',
|
'DEFAULT_FROM_EMAIL',
|
||||||
default=f'{CONSTANCE_CONFIG["PROJECT_SHORT_NAME"][0]}@localhost.localdomain')
|
default=f'{PROJECT_SHORT_NAME}@localhost.localdomain')
|
||||||
SERVER_EMAIL = DEFAULT_FROM_EMAIL
|
SERVER_EMAIL = DEFAULT_FROM_EMAIL
|
||||||
|
|
||||||
if EMAIL_HOST is None:
|
if EMAIL_HOST is None:
|
||||||
@@ -561,10 +549,10 @@ BOOTSTRAP_DATEPICKER_PLUS = {
|
|||||||
|
|
||||||
PWA_SERVICE_WORKER_PATH = BASE_DIR.joinpath('static/js', 'serviceworker.js')
|
PWA_SERVICE_WORKER_PATH = BASE_DIR.joinpath('static/js', 'serviceworker.js')
|
||||||
|
|
||||||
PWA_APP_NAME = CONSTANCE_CONFIG["PROJECT_SHORT_NAME"][0]
|
PWA_APP_NAME = PROJECT_SHORT_NAME
|
||||||
PWA_APP_DESCRIPTION = CONSTANCE_CONFIG["PROJECT_LONG_NAME"][0]
|
PWA_APP_DESCRIPTION = PROJECT_DESCRIPTION
|
||||||
PWA_APP_THEME_COLOR = CONSTANCE_CONFIG["PROJECT_THEME_COLOR"][0]
|
PWA_APP_THEME_COLOR = THEME_COLOR
|
||||||
PWA_APP_BACKGROUND_COLOR = '#ffffff'
|
PWA_APP_BACKGROUND_COLOR = BACKGROUND_COLOR
|
||||||
PWA_APP_DISPLAY = 'standalone'
|
PWA_APP_DISPLAY = 'standalone'
|
||||||
PWA_APP_SCOPE = '/'
|
PWA_APP_SCOPE = '/'
|
||||||
PWA_APP_ORIENTATION = 'any'
|
PWA_APP_ORIENTATION = 'any'
|
||||||
@@ -573,24 +561,24 @@ PWA_APP_STATUS_BAR_COLOR = 'default'
|
|||||||
PWA_APP_ICONS = [
|
PWA_APP_ICONS = [
|
||||||
{
|
{
|
||||||
'src': '/media/icon-192x192.png',
|
'src': '/media/icon-192x192.png',
|
||||||
'sizes': '160x160'
|
'sizes': '192x192'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
PWA_APP_ICONS_APPLE = [
|
PWA_APP_ICONS_APPLE = [
|
||||||
{
|
{
|
||||||
'src': '/media/icon-192x192.png',
|
'src': '/media/icon-192x192.png',
|
||||||
'sizes': '160x160'
|
'sizes': '192x192'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
PWA_APP_SPLASH_SCREEN = [
|
PWA_APP_SPLASH_SCREEN = [
|
||||||
{
|
{
|
||||||
'src': '/media/icon.png',
|
'src': '/media/icon-192x192.png',
|
||||||
'media': '(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2)'
|
'media': '(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2)'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
PWA_APP_DIR = 'ltr'
|
PWA_APP_DIR = 'ltr'
|
||||||
PWA_APP_LANG = 'en-GB'
|
PWA_APP_LANG = 'en-GB'
|
||||||
PWA_APP_DEBUG_MODE = False
|
PWA_APP_DEBUG_MODE = DEBUG
|
||||||
|
|
||||||
# Database default automatic primary key
|
# Database default automatic primary key
|
||||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
|
|||||||
@@ -1,25 +1,11 @@
|
|||||||
var staticCacheName = "django-pwa-v" + new Date().getTime();
|
var staticCacheName = "django-pwa-v" + new Date().getTime();
|
||||||
var filesToCache = [
|
var filesToCache = [
|
||||||
'/offline',
|
"/offline",
|
||||||
'/css/django-pwa-app.css',
|
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/fontawesome.min.css",
|
||||||
'/media/icon-72x72.png',
|
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/solid.min.css",
|
||||||
'/media/icon-96x96.png',
|
"/static/css/global.css",
|
||||||
'/media/icon-128x128.png',
|
"/static/hijack/hijack.min.css",
|
||||||
'/media/icon-144x144.png',
|
"/media/icon-192x192.png",
|
||||||
'/media/icon-152x152.png',
|
|
||||||
'/media/icon-192x192.png',
|
|
||||||
'/media/icon-384x384.png',
|
|
||||||
'/media/icon-512x512.png',
|
|
||||||
'/static/media/splash-640x1136.png',
|
|
||||||
'/static/media/splash-750x1334.png',
|
|
||||||
'/static/media/splash-1242x2208.png',
|
|
||||||
'/static/media/splash-1125x2436.png',
|
|
||||||
'/static/media/splash-828x1792.png',
|
|
||||||
'/static/media/splash-1242x2688.png',
|
|
||||||
'/static/media/splash-1536x2048.png',
|
|
||||||
'/static/media/splash-1668x2224.png',
|
|
||||||
'/static/media/splash-1668x2388.png',
|
|
||||||
'/static/media/splash-2048x2732.png'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// Cache on install
|
// Cache on install
|
||||||
|
|||||||
@@ -8,13 +8,13 @@
|
|||||||
|
|
||||||
{% load pwa %}
|
{% load pwa %}
|
||||||
|
|
||||||
<link rel="manifest" href="manifest.json">
|
<link rel="manifest" href="/manifest.json">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<!-- Required meta tags -->
|
<!-- Required meta tags -->
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
<title>{{ config.PROJECT_LONG_NAME }}</title>
|
<title>{{ settings.PROJECT_LONG_NAME }}</title>
|
||||||
|
|
||||||
<!-- Bootstrap CSS -->
|
<!-- Bootstrap CSS -->
|
||||||
{% bootstrap_css %}
|
{% bootstrap_css %}
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<a href="{% url 'index' %}" class="navbar-brand">
|
<a href="{% url 'index' %}" class="navbar-brand">
|
||||||
{{ config.PROJECT_SHORT_NAME }}
|
{{ settings.PROJECT_SHORT_NAME }}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<button type="button" class="navbar-toggler"
|
<button type="button" class="navbar-toggler"
|
||||||
@@ -220,7 +220,7 @@
|
|||||||
|
|
||||||
<footer class="footer bg-light">
|
<footer class="footer bg-light">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<span class="text-muted">{{ config.PROJECT_LONG_NAME }}</span>
|
<span class="text-muted">{{ settings.PROJECT_LONG_NAME }}</span>
|
||||||
<span class="text-muted">Developed by the <a href="https://gcrf-breccia.com">BRECcIA</a> team</span>
|
<span class="text-muted">Developed by the <a href="https://gcrf-breccia.com">BRECcIA</a> team</span>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="mx-5 px-4 my-3 pt-3 pb-2 textbox-container">
|
<div class="mx-5 px-4 my-3 pt-3 pb-2 textbox-container">
|
||||||
<h1 class="display-1">{{ config.PROJECT_LONG_NAME }}</h1>
|
<h1 class="display-1">{{ settings.PROJECT_LONG_NAME }}</h1>
|
||||||
<p class="lead">{{ config.PROJECT_LEAD }}</p>
|
<p class="lead">{{ config.PROJECT_LEAD }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -20,10 +20,8 @@ from django.conf.urls.static import static
|
|||||||
|
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
from constance import config
|
admin.site.site_header = settings.PROJECT_LONG_NAME + " Admin"
|
||||||
|
admin.site.site_title = settings.PROJECT_SHORT_NAME + " Admin"
|
||||||
admin.site.site_header = config.PROJECT_LONG_NAME + " Admin"
|
|
||||||
admin.site.site_title = config.PROJECT_SHORT_NAME + " Admin"
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('admin/',
|
path('admin/',
|
||||||
|
|||||||
4
deploy/Vagrantfile
vendored
4
deploy/Vagrantfile
vendored
@@ -21,9 +21,7 @@ Vagrant.configure("2") do |config|
|
|||||||
ansible.playbook = "playbook.yml"
|
ansible.playbook = "playbook.yml"
|
||||||
ansible.host_vars = {
|
ansible.host_vars = {
|
||||||
"default" => {
|
"default" => {
|
||||||
"deploy_environment" => "vagrant",
|
"deploy_environment" => "vagrant"
|
||||||
"django_debug" => 1,
|
|
||||||
"django_secret_key" => "debug_only_g62WlORMbo8iAcV7vKCKBQ=="
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
130
deploy/example.env
Normal file
130
deploy/example.env
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
# REQUIRED=Secret key
|
||||||
|
# Used to generate CSRF tokens - must never be made public
|
||||||
|
SECRET_KEY=changeme
|
||||||
|
|
||||||
|
# Debug
|
||||||
|
# Should the server run in debug mode? Provides information to users which is unsafe in production
|
||||||
|
# Default: False
|
||||||
|
DEBUG=False
|
||||||
|
|
||||||
|
# Project long name
|
||||||
|
# The project's full name.
|
||||||
|
# Default: Project Network Mapper
|
||||||
|
# PROJECT_LONG_NAME=Project Network Mapper
|
||||||
|
|
||||||
|
# Project short name
|
||||||
|
# The project's short/abbreviated name. This will also be used as the app's name when installed as PWA.
|
||||||
|
# Default: Network Mapper
|
||||||
|
# PROJECT_SHORT_NAME=Network Mapper
|
||||||
|
|
||||||
|
# Project description
|
||||||
|
# The project's description. Used when installed as a PWA.
|
||||||
|
# Default: Application to map network relationships in the organisation.
|
||||||
|
# PROJECT_DESCRIPTION=Application to map network relationships in the organisation.
|
||||||
|
|
||||||
|
# Theme color
|
||||||
|
# The project's theme color, in hex format (excluding the leading #).
|
||||||
|
# Default: 212121
|
||||||
|
# THEME_COLOR=212121
|
||||||
|
|
||||||
|
# Background color
|
||||||
|
# The project's background color, in hex format (excluding the leading #).
|
||||||
|
# Default: ffffff
|
||||||
|
# BACKGROUND_COLOR=ffffff
|
||||||
|
|
||||||
|
# Allowed hosts
|
||||||
|
# Accepted values for server header in request - protects against CSRF and CSS attacks
|
||||||
|
# Default: * if DEBUG else localhost
|
||||||
|
# ALLOWED_HOSTS=127.0.0.1,localhost,localhost.localdomain
|
||||||
|
|
||||||
|
# Site URL
|
||||||
|
# The URL the site will be deployed on. Do not include http://, https://, or a trailing slash.
|
||||||
|
# Default: localhost
|
||||||
|
# SITE_URL=localhost
|
||||||
|
|
||||||
|
# Site protocol
|
||||||
|
# The protocol the site uses. Valid options are http or https.
|
||||||
|
# Default: http
|
||||||
|
# SITE_PROTOCOL=http
|
||||||
|
|
||||||
|
# Trusted origins
|
||||||
|
# The trusted origin domains of requests - protects against CSRF and CSS attacks
|
||||||
|
# Default: '*' if DEBUG else 'http://127.0.0.1,http://localhost,http://localhost.localdomain'
|
||||||
|
# TRUSTED_ORIGINS=http://127.0.0.1,http://localhost,http://localhost.localdomain
|
||||||
|
|
||||||
|
# Database backup storage location
|
||||||
|
# Directory where database backups should be stored
|
||||||
|
# Default: .dbbackup
|
||||||
|
# DBBACKUP_STORAGE_LOCATION=.dbbackup
|
||||||
|
|
||||||
|
# Default language
|
||||||
|
# Default language - used for translation - has not been enabled
|
||||||
|
# Default: en-gb
|
||||||
|
# LANGUAGE_CODE=en-gb
|
||||||
|
|
||||||
|
# Timezone
|
||||||
|
# Default timezone
|
||||||
|
# Default: UTC
|
||||||
|
# TIME_ZONE=UTC
|
||||||
|
|
||||||
|
# Logging level
|
||||||
|
# Level of messages written to log file
|
||||||
|
# Default: INFO
|
||||||
|
# LOG_LEVEL=INFO
|
||||||
|
|
||||||
|
# Logging filename
|
||||||
|
# Path to logfile
|
||||||
|
# Default: debug.log
|
||||||
|
# LOG_FILENAME=debug.log
|
||||||
|
|
||||||
|
# Logging duration
|
||||||
|
# Number of days of logs to keep - logfile is rotated out at the end of each day
|
||||||
|
# Default: 14
|
||||||
|
# LOG_DAYS=14
|
||||||
|
|
||||||
|
# STMP host
|
||||||
|
# Hostname of SMTP server
|
||||||
|
# Default: None
|
||||||
|
# EMAIL_HOST=None
|
||||||
|
|
||||||
|
# Default from email address
|
||||||
|
# Email address from which messages are sent
|
||||||
|
# Default: None
|
||||||
|
# DEFAULT_FROM_EMAIL=None
|
||||||
|
|
||||||
|
# [DEBUG ONLY] Email file path
|
||||||
|
# Directory where emails will be stored if not using an SMTP server
|
||||||
|
# Default: mail.log
|
||||||
|
# EMAIL_FILE_PATH=mail.log
|
||||||
|
|
||||||
|
# SMTP username
|
||||||
|
# Username to authenticate with SMTP server
|
||||||
|
# Default: None
|
||||||
|
# EMAIL_HOST_USER=None
|
||||||
|
|
||||||
|
# SMTP password
|
||||||
|
# Password to authenticate with SMTP server
|
||||||
|
# Default: None
|
||||||
|
# EMAIL_HOST_PASSWORD=None
|
||||||
|
|
||||||
|
# SMTP port
|
||||||
|
# Port to access on SMTP server
|
||||||
|
# Default: 25
|
||||||
|
# EMAIL_PORT=25
|
||||||
|
|
||||||
|
# SMTP use TLS
|
||||||
|
# Use TLS to communicate with SMTP server? Usually on port 587
|
||||||
|
# Cannot be enabled at the same time as EMAIL_USE_SSL
|
||||||
|
# Default: True if EMAIL_PORT == 587 else False
|
||||||
|
# EMAIL_USE_TLS=True if EMAIL_PORT == 587 else False
|
||||||
|
|
||||||
|
# SMTP use SSL
|
||||||
|
# Use SSL to communicate with SMTP server? Usually on port 465
|
||||||
|
# Cannot be enabled at the same time as EMAIL_USE_TLS
|
||||||
|
# Default: True if EMAIL_PORT == 465 else False
|
||||||
|
# EMAIL_USE_SSL=True if EMAIL_PORT == 465 else False
|
||||||
|
|
||||||
|
# Google Maps API key
|
||||||
|
# Google Maps API key to display maps of people's locations
|
||||||
|
# Default: None
|
||||||
|
# GOOGLE_MAPS_API_KEY=None
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
all:
|
all:
|
||||||
hosts:
|
hosts:
|
||||||
example.com:
|
example.com:
|
||||||
django_debug: 0
|
|
||||||
django_secret_key: debug_only_g62WlORMbo8iAcV7vKCKBQ==
|
|
||||||
|
|||||||
@@ -61,8 +61,14 @@
|
|||||||
|
|
||||||
- name: Copy settings file
|
- name: Copy settings file
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: 'settings.ini'
|
src: '.env'
|
||||||
dest: '{{ project_src_dir }}/breccia_mapper/settings.ini'
|
dest: '{{ project_dir }}/.env'
|
||||||
|
mode: 0600
|
||||||
|
|
||||||
|
- name: Copy site icon
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: 'icon-192x192.png'
|
||||||
|
dest: '{{ project_dir }}/icon-192x192.png'
|
||||||
mode: 0600
|
mode: 0600
|
||||||
|
|
||||||
- name: Create database file
|
- name: Create database file
|
||||||
@@ -104,5 +110,5 @@
|
|||||||
- name: Display warning about new superuser
|
- name: Display warning about new superuser
|
||||||
debug:
|
debug:
|
||||||
msg:
|
msg:
|
||||||
- "[WARNING] A superuser has been provisioned with the username \"{{ superuser_username }}\" and password that was provided. This user has unlimited access to the network mapper."
|
- "[WARNING] A superuser has been provisioned with the username \"{{ superuser_username }}\" and the password that was provided. This user has unlimited access to the network mapper."
|
||||||
when: provision_superuser
|
when: provision_superuser
|
||||||
@@ -1,112 +0,0 @@
|
|||||||
[settings]
|
|
||||||
|
|
||||||
; REQUIRED=Secret key
|
|
||||||
; Used to generate CSRF tokens - must never be made public
|
|
||||||
SECRET_KEY=changeme
|
|
||||||
|
|
||||||
; Debug
|
|
||||||
; Should the server run in debug mode? Provides information to users which is unsafe in production
|
|
||||||
; Default: False
|
|
||||||
DEBUG=False
|
|
||||||
|
|
||||||
; Allowed hosts
|
|
||||||
; Accepted values for server header in request - protects against CSRF and CSS attacks
|
|
||||||
; Default: * if DEBUG else localhost
|
|
||||||
# ALLOWED_HOSTS=127.0.0.1,localhost,localhost.localdomain
|
|
||||||
|
|
||||||
; Site URL
|
|
||||||
; The URL the site will be deployed on. Do not include http://, https://, or a trailing slash.
|
|
||||||
; Default: localhost
|
|
||||||
# SITE_URL=localhost
|
|
||||||
|
|
||||||
; Site protocol
|
|
||||||
; The protocol the site uses. Valid options are http or https.
|
|
||||||
; Default: http
|
|
||||||
# SITE_PROTOCOL=http
|
|
||||||
|
|
||||||
; Trusted origins
|
|
||||||
; The trusted origin domains of requests - protects against CSRF and CSS attacks
|
|
||||||
; Default: '*' if DEBUG else 'http://127.0.0.1,http://localhost,http://localhost.localdomain'
|
|
||||||
# TRUSTED_ORIGINS=http://127.0.0.1,http://localhost,http://localhost.localdomain
|
|
||||||
|
|
||||||
; Database URL
|
|
||||||
; URL to database - uses format described at https://github.com/jacobian/dj-database-url
|
|
||||||
; Default: sqlite://db.sqlite3
|
|
||||||
# DATABASE_URL=sqlite://db.sqlite3
|
|
||||||
|
|
||||||
; Database backup storage location
|
|
||||||
; Directory where database backups should be stored
|
|
||||||
; Default: .dbbackup
|
|
||||||
# DBBACKUP_STORAGE_LOCATION=.dbbackup
|
|
||||||
|
|
||||||
; Default language
|
|
||||||
; Default language - used for translation - has not been enabled
|
|
||||||
; Default: en-gb
|
|
||||||
# LANGUAGE_CODE=en-gb
|
|
||||||
|
|
||||||
; Timezone
|
|
||||||
; Default timezone
|
|
||||||
; Default: UTC
|
|
||||||
# TIME_ZONE=UTC
|
|
||||||
|
|
||||||
; Logging level
|
|
||||||
; Level of messages written to log file
|
|
||||||
; Default: INFO
|
|
||||||
# LOG_LEVEL=INFO
|
|
||||||
|
|
||||||
; Logging filename
|
|
||||||
; Path to logfile
|
|
||||||
; Default: debug.log
|
|
||||||
# LOG_FILENAME=debug.log
|
|
||||||
|
|
||||||
; Logging duration
|
|
||||||
; Number of days of logs to keep - logfile is rotated out at the end of each day
|
|
||||||
; Default: 14
|
|
||||||
# LOG_DAYS=14
|
|
||||||
|
|
||||||
; STMP host
|
|
||||||
; Hostname of SMTP server
|
|
||||||
; Default: None
|
|
||||||
# EMAIL_HOST=None
|
|
||||||
|
|
||||||
; Default from email address
|
|
||||||
; Email address from which messages are sent
|
|
||||||
; Default: None
|
|
||||||
# DEFAULT_FROM_EMAIL=None
|
|
||||||
|
|
||||||
; [DEBUG ONLY] Email file path
|
|
||||||
; Directory where emails will be stored if not using an SMTP server
|
|
||||||
; Default: mail.log
|
|
||||||
# EMAIL_FILE_PATH=mail.log
|
|
||||||
|
|
||||||
; SMTP username
|
|
||||||
; Username to authenticate with SMTP server
|
|
||||||
; Default: None
|
|
||||||
# EMAIL_HOST_USER=None
|
|
||||||
|
|
||||||
; SMTP password
|
|
||||||
; Password to authenticate with SMTP server
|
|
||||||
; Default: None
|
|
||||||
# EMAIL_HOST_PASSWORD=None
|
|
||||||
|
|
||||||
; SMTP port
|
|
||||||
; Port to access on SMTP server
|
|
||||||
; Default: 25
|
|
||||||
# EMAIL_PORT=25
|
|
||||||
|
|
||||||
; SMTP use TLS
|
|
||||||
; Use TLS to communicate with SMTP server? Usually on port 587
|
|
||||||
; Cannot be enabled at the same time as EMAIL_USE_SSL
|
|
||||||
; Default: True if EMAIL_PORT == 587 else False
|
|
||||||
# EMAIL_USE_TLS=True if EMAIL_PORT == 587 else False
|
|
||||||
|
|
||||||
; SMTP use SSL
|
|
||||||
; Use SSL to communicate with SMTP server? Usually on port 465
|
|
||||||
; Cannot be enabled at the same time as EMAIL_USE_TLS
|
|
||||||
; Default: True if EMAIL_PORT == 465 else False
|
|
||||||
# EMAIL_USE_SSL=True if EMAIL_PORT == 465 else False
|
|
||||||
|
|
||||||
; Google Maps API key
|
|
||||||
; Google Maps API key to display maps of people's locations
|
|
||||||
; Default: None
|
|
||||||
# GOOGLE_MAPS_API_KEY=None
|
|
||||||
@@ -8,13 +8,14 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- 8000:8000
|
- 8000:8000
|
||||||
environment:
|
environment:
|
||||||
DEBUG: {{ django_debug }}
|
DJANGO_DEBUG: ${DEBUG}
|
||||||
DATABASE_URL: sqlite:////app/db.sqlite3
|
env_file:
|
||||||
SECRET_KEY: {{ django_secret_key }}
|
- .env
|
||||||
volumes:
|
volumes:
|
||||||
- {{ project_dir }}/db.sqlite3:/app/db.sqlite3:z
|
- {{ project_dir }}/db.sqlite3:/app/db.sqlite3:z
|
||||||
- static_files:/app/static
|
- static_files:/app/static
|
||||||
- media_files:/app/media
|
- media_files:/app/media
|
||||||
|
- {{ project_dir }}/icon-192x192.png:/app/media/icon-192x192.png:ro
|
||||||
|
|
||||||
caddy:
|
caddy:
|
||||||
image: caddy:2
|
image: caddy:2
|
||||||
|
|||||||
@@ -8,13 +8,14 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- 8000:8000
|
- 8000:8000
|
||||||
environment:
|
environment:
|
||||||
DEBUG: ${DJANGO_DEBUG}
|
DJANGO_DEBUG: ${DEBUG}
|
||||||
DATABASE_URL: sqlite:////app/db.sqlite3
|
env_file:
|
||||||
SECRET_KEY: ${DJANGO_SECRET_KEY}
|
- .env
|
||||||
volumes:
|
volumes:
|
||||||
- ./db.sqlite3:/app/db.sqlite3:z
|
- ./db.sqlite3:/app/db.sqlite3:z
|
||||||
- static_files:/app/static
|
- static_files:/app/static
|
||||||
- media_files:/app/media
|
- media_files:/app/media
|
||||||
|
- ./icon-192x192.png:/app/media/icon-192x192.png:ro
|
||||||
|
|
||||||
caddy:
|
caddy:
|
||||||
image: caddy:2
|
image: caddy:2
|
||||||
|
|||||||
BIN
media/icon.png
BIN
media/icon.png
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB |
@@ -6,9 +6,9 @@
|
|||||||
"description": "Default welcome email template",
|
"description": "Default welcome email template",
|
||||||
"created": "2020-04-27T12:13:30.448Z",
|
"created": "2020-04-27T12:13:30.448Z",
|
||||||
"last_updated": "2020-04-27T14:45:27.152Z",
|
"last_updated": "2020-04-27T14:45:27.152Z",
|
||||||
"subject": "Welcome to {{config.PROJECT_LONG_NAME}}",
|
"subject": "Welcome to {{settings.PROJECT_LONG_NAME}}",
|
||||||
"content": "Dear user,\r\n\r\nWelcome to {{ config.PROJECT_LONG_NAME }}. You can set your password at {{ settings.SITE_PROTOCOL }}://{{ settings.SITE_URL }}/password_reset/.\r\n\r\nYour username is {{ user.username }}.\r\nThanks,\r\n\r\nThe {{ config.PROJECT_SHORT_NAME }} team",
|
"content": "Dear user,\r\n\r\nWelcome to {{ settings.PROJECT_LONG_NAME }}. You can set your password at {{ settings.SITE_PROTOCOL }}://{{ settings.SITE_URL }}/password_reset/.\r\n\r\nYour username is {{ user.username }}.\r\nThanks,\r\n\r\nThe {{ settings.PROJECT_SHORT_NAME }} team",
|
||||||
"html_content": "<h1>{{ config.PROJECT_LONG_NAME }}</h1><br/><p>Dear user,</p><br/><p>Welcome to {{ config.PROJECT_LONG_NAME }}. You can set your password <a href='{{ settings.SITE_PROTOCOL }}://{{ settings.SITE_URL }}/password_reset/'>here</a>.</p><p>Your username is {{ user.username }}.</p><br/><p>Thanks,</p><p>The {{ config.PROJECT_SHORT_NAME }} team</p>",
|
"html_content": "<h1>{{ settings.PROJECT_LONG_NAME }}</h1><br/><p>Dear user,</p><br/><p>Welcome to {{ settings.PROJECT_LONG_NAME }}. You can set your password <a href='{{ settings.SITE_PROTOCOL }}://{{ settings.SITE_URL }}/password_reset/'>here</a>.</p><p>Your username is {{ user.username }}.</p><br/><p>Thanks,</p><p>The {{ settings.PROJECT_SHORT_NAME }} team</p>",
|
||||||
"language": "",
|
"language": "",
|
||||||
"default_template": null
|
"default_template": null
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user