Environment variables and count/edit restyling

This commit is contained in:
Claudio Maggioni 2018-08-12 20:50:09 +02:00
parent 45e1274635
commit e646089dd6
6 changed files with 54 additions and 10 deletions

7
.env.debug Normal file
View file

@ -0,0 +1,7 @@
DEBUG=true
POSTGRES_HOST=localhost
POSTGRES_DB=arrowcounter
POSTGRES_USER=arrowcounter
POSTGRES_PASSWORD=password
SECURITY_KEY=malusa
ALLOWED_HOSTS=192.168.1.201

View file

@ -48,9 +48,11 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# 'django_extensions'
]
if DEBUG:
INSTALLED_APPS.append('django_extensions')
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',

View file

@ -6,6 +6,14 @@ form p, form .card .card-content p {
margin-top: 1em;
}
form p:first-child, form .card .card-content p:first-child {
margin-top: 0;
}
.card-content .row:last-child {
margin-bottom: 0;
}
form span.helptext {
width: 100%;
display: inline-block;
@ -49,26 +57,35 @@ form .card-action button[type=submit] {
margin-right: auto;
}
#edit-arrowcount-form input {
text-align: center
}
#edit-arrowcount-form #id_count {
font-size: 3em;
padding: .25em 0;
}
.count-up, .count-down {
width: 100%;
}
.count-up {
height: 25vh;
height: 8rem;
}
.count-down {
height: 12.5vh;
height: 5rem;
}
.count-up .material-icons {
font-size: 20vh;
line-height: 25vh;
font-size: 7rem;
line-height: 8rem;
}
.count-down .material-icons {
font-size: 10vh;
line-height: 12.5vh;
font-size: 4.5rem;
line-height: 5rem;
}
.inline-block {

View file

@ -7,9 +7,12 @@
<head>
<title>{% block title %}{% endblock %} | Arrow Counter</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-rc.2/css/materialize.min.css">
<meta name="viewport"
content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-rc.2/css/materialize.min.css">
<link rel="stylesheet" href="{% static "css/main.css" %}">
{% block style %}{% endblock %}
</head>

View file

@ -1,8 +1,22 @@
#!/usr/bin/env python
import os
import sys
from dotenv import load_dotenv
from os import path
if __name__ == '__main__':
env_path = path.join(path.dirname(path.realpath(__file__)), '.env')
load_dotenv(verbose=True,dotenv_path=env_path)
check_env_vars = ['POSTGRES_DB', 'POSTGRES_HOST', 'POSTGRES_PASSWORD',
'POSTGRES_USER', 'DEBUG', 'ALLOWED_HOSTS']
for key in check_env_vars:
if key not in os.environ:
sys.stderr.write('The mandatory environment ' \
'variable ' + key + ' is not set\n')
sys.exit(1)
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'arrowcounter.settings')
try:
from django.core.management import execute_from_command_line

View file

@ -1 +1,2 @@
django
python-dotenv