diff --git a/breccia_mapper/settings.py b/breccia_mapper/settings.py index 211d98a..7f5ba6d 100644 --- a/breccia_mapper/settings.py +++ b/breccia_mapper/settings.py @@ -8,6 +8,9 @@ https://docs.djangoproject.com/en/2.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.2/ref/settings/ + +Before production deployment, see +https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ """ import collections @@ -16,13 +19,25 @@ import pathlib from decouple import config, Csv import dj_database_url + +# Settings exported to templates +# https://github.com/jakubroztocil/django-settings-export + +SETTINGS_EXPORT = [ + 'DEBUG', + 'PROJECT_LONG_NAME', + 'PROJECT_SHORT_NAME', +] + + +PROJECT_LONG_NAME = config('PROJECT_LONG_NAME', default='Project Long Name') +PROJECT_SHORT_NAME = config('PROJECT_SHORT_NAME', default='shortname') + + # Build paths inside the project like this: BASE_DIR.joinpath(...) BASE_DIR = pathlib.Path(__file__).parent.parent -# Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ - # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = config('SECRET_KEY') @@ -48,6 +63,9 @@ DJANGO_APPS = [ ] THIRD_PARTY_APPS = [ + 'bootstrap4', + 'constance', + 'constance.backends.database', ] FIRST_PARTY_APPS = [ @@ -75,6 +93,8 @@ TEMPLATES = [ 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ + 'django_settings_export.settings_export', + 'constance.context_processors.config', 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', diff --git a/breccia_mapper/static/css/global.css b/breccia_mapper/static/css/global.css new file mode 100644 index 0000000..4990a4d --- /dev/null +++ b/breccia_mapper/static/css/global.css @@ -0,0 +1,21 @@ +/* Sticky footer from https://css-tricks.com/couple-takes-sticky-footer/#article-header-id-3 */ +html, body { + height: 100%; +} + +body { + display: flex; + flex-direction: column; +} + +.content { + flex: 1 0 auto; +} + + +.footer { + height: 60px; + line-height: 60px; + flex-shrink: 0; +} +/* end of sticky footer styles */ diff --git a/breccia_mapper/static/css/masthead.css b/breccia_mapper/static/css/masthead.css new file mode 100644 index 0000000..56fb41e --- /dev/null +++ b/breccia_mapper/static/css/masthead.css @@ -0,0 +1,39 @@ +header.masthead { + position: relative; + background: #343a40 no-repeat center; + -webkit-background-size: cover; + -moz-background-size: cover; + -o-background-size: cover; + background-size: cover; + padding-top: 8rem; + padding-bottom: 8rem; + min-height: 200px; + height: 60vh; + z-index: -2; +} + +header.masthead .overlay { + position: absolute; + background-color: #212529; + height: 100%; + width: 100%; + top: 0; + left: 0; + opacity: 0.4; + z-index: -1; +} + +header.masthead .textbox-container { + background-color: rgba(30, 30, 30, 0.2); +} + +@media (min-width: 768px) { + header.masthead { + padding-top: 1rem; + padding-bottom: 12rem; + } + + header.masthead h1 { + font-size: 3rem; + } +} diff --git a/breccia_mapper/templates/base.html b/breccia_mapper/templates/base.html new file mode 100644 index 0000000..60f1389 --- /dev/null +++ b/breccia_mapper/templates/base.html @@ -0,0 +1,149 @@ + +{% load bootstrap4 %} +{% if 'use_i18n'|bootstrap_setting %} + {% load i18n %} + {% get_current_language as LANGUAGE_CODE %} +{% endif %} + + + + + + + + + + {% bootstrap_css %} + + + + + + {% load staticfiles %} + + + {% if 'javascript_in_head'|bootstrap_setting %} + {% if 'include_jquery'|bootstrap_setting %} + {# jQuery JavaScript if it is in head #} + {% bootstrap_jquery jquery='include_jquery'|bootstrap_setting %} + {% endif %} + + {# Bootstrap JavaScript if it is in head #} + {% bootstrap_javascript %} + {% endif %} + + {% block extra_head %}{% endblock %} + + + + +
+ {% block navbar %} + + {% endblock %} + + {# Global banner if config.NOTICE_TEXT is set using Constance #} + {% if config.NOTICE_TEXT %} + + {% endif %} + + {% block before_content %}{% endblock %} + +
+ {# Display Django messages as Bootstrap alerts #} + {% bootstrap_messages %} + + {% block content %}{% endblock %} +
+ +
+ {% block after_content %}{% endblock %} +
+
+ + + +{% if not 'javascript_in_head'|bootstrap_setting %} + {% if 'include_jquery'|bootstrap_setting %} + {# jQuery JavaScript if it is in body #} + {% bootstrap_jquery jquery='include_jquery'|bootstrap_setting %} + {% endif %} + + {# Bootstrap JavaScript if it is in body #} + {% bootstrap_javascript %} +{% endif %} + +{% block extra_script %}{% endblock %} + + + diff --git a/breccia_mapper/templates/index.html b/breccia_mapper/templates/index.html new file mode 100644 index 0000000..8f6c0c4 --- /dev/null +++ b/breccia_mapper/templates/index.html @@ -0,0 +1,79 @@ +{% extends 'base.html' %} + +{% block extra_head %} + {% load staticfiles %} + +{% endblock %} + +{% block before_content %} +
+
+ +
+
+

{{ settings.PROJECT_LONG_NAME }}

+

Snappy leader here...

+
+
+
+ +
+
+

Snappy tagline here...

+
+
+ +
+
+
+
+
+
+

Do Feature 1

+ + +
+
+
+ +
+
+
+

Do Feature 2

+ + +
+
+
+ +
+
+
+

Do Feature 3

+ + +
+
+
+
+
+
+{% endblock %} + +{% block content %} +
+
+

About {{ settings.PROJECT_LONG_NAME }}

+ +

+ {{ settings.PROJECT_LONG_NAME }} is... +

+
+ +
+ +
+
+{% endblock %} diff --git a/breccia_mapper/urls.py b/breccia_mapper/urls.py index 7fa8c62..c1eee42 100644 --- a/breccia_mapper/urls.py +++ b/breccia_mapper/urls.py @@ -14,8 +14,17 @@ Including another URLconf 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin -from django.urls import path +from django.urls import include, path + +from . import views urlpatterns = [ path('admin/', admin.site.urls), + + path('', + include('django.contrib.auth.urls')), + + path('', + views.IndexView.as_view(), + name='index'), ] diff --git a/breccia_mapper/views.py b/breccia_mapper/views.py new file mode 100644 index 0000000..2844b2c --- /dev/null +++ b/breccia_mapper/views.py @@ -0,0 +1,5 @@ +from django.views.generic import TemplateView + + +class IndexView(TemplateView): + template_name = 'index.html' diff --git a/requirements.txt b/requirements.txt index 13dae2c..d910fa1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,7 @@ dj-database-url django~=2.2 -django-constance +django-bootstrap4 +django-constance[database] django-dbbackup +django-settings-export python-decouple