Skip to content
Snippets Groups Projects
Commit 96ccb563 authored by Zdenek Kubala's avatar Zdenek Kubala
Browse files

set production env vars

parent b1959230
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pathlib import Path
from os import getenv
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
......@@ -20,11 +21,17 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-kog+-x*xtt5e7shmxa-ddldzdtz@u#*tj^s9jzm#%&ghy*a8x%'
SECRET_KEY = getenv('SECRET_KEY')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
#DEBUG = True
#DEBUG = False
DJANGO_ENV = getenv('DJANGO_ENV', 'production').lower()
if DJANGO_ENV == 'local':
DEBUG = True
elif DJANGO_ENV == 'production':
DEBUG = False
ALLOWED_HOSTS = ['*']
......@@ -86,6 +93,9 @@ DATABASES = {
}
}
if DJANGO_ENV == 'production':
DATABASES = {"default": env.db("DATABASE_URL")}
# Password validation
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
......@@ -136,7 +146,6 @@ LOGIN_REDIRECT_URL = 'home'
LOGOUT_REDIRECT_URL = 'index'
# Custom settings STATIC
STATIC_URL = "/static/"
STATIC_ROOT = BASE_DIR / 'static'
#STATICFILES_DIRS = BASE_DIR / 'static'
......@@ -172,3 +181,10 @@ TINYMCE_DEFAULT_CONFIG = {
'statusbar': True,
}
# Custom settings Registration
ACCOUNT_ACTIVATION_DAYS = 7
EMAIL_HOST = 'mail2.playzone.cz'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = getenv('SMTP_USER')
EMAIL_HOST_PASSWORD = getenv('SMTP_PASSWORD')
......@@ -27,3 +27,4 @@ urlpatterns = [
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
......@@ -41,11 +41,11 @@
outline: none;
font-size: 15px;
}
.active, .collapsible:hover {
background-color: #555;
}
.content {
padding: 0 18px;
overflow: hidden;
......@@ -53,7 +53,7 @@
max-height: 0;
transition: max-height 0.2s ease-out;
}
</style>
</style>
{% if settings.SIFROVACKA_ENV == "prod" and settings.ONBOARDING_MATOMO_ID %}
{% include "shared/matomo_snippet.html" with matomo_id=settings.ONBOARDING_MATOMO_ID %}
......@@ -72,7 +72,7 @@
<div>
<div class="container container--wide navbar__content navbar__content--initialized">
<div class="navbar__brand my-4 flex items-center lg:pr-8 lg:my-0">
<a href="/"><img src="https://styleguide.pir-test.eu/2.3.x/images/logo-round-white.svg" class="w-8"></a>
<img src="https://styleguide.pir-test.eu/2.3.x/images/logo-round-white.svg" class="w-8">
<span class="pl-4 font-bold text-xl lg:border-r lg:border-grey-300 lg:pr-8">
<a href={% url "index"%}>Šifrovačka</a>
{% if settings.SIFROVACKA_ENV == "dev" %}<sup class="text-cyan-100">(DEV)</sup>{% endif %}
......
......@@ -6,6 +6,8 @@ from . import views
urlpatterns = [
# accounts uls
# two step auth not working yet
# path('accounts/', include('django_registration.backends.activation.urls')),
path('accounts/', include('django_registration.backends.one_step.urls')),
path('accounts/', include('django.contrib.auth.urls')),
# the 'name' value as called by the {% url %} template tag
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment