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.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
# 'django_extensions'
] ]
if DEBUG:
INSTALLED_APPS.append('django_extensions')
MIDDLEWARE = [ MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware', 'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',

View file

@ -6,6 +6,14 @@ form p, form .card .card-content p {
margin-top: 1em; 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 { form span.helptext {
width: 100%; width: 100%;
display: inline-block; display: inline-block;
@ -49,26 +57,35 @@ form .card-action button[type=submit] {
margin-right: auto; 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 { .count-up, .count-down {
width: 100%; width: 100%;
} }
.count-up { .count-up {
height: 25vh; height: 8rem;
} }
.count-down { .count-down {
height: 12.5vh; height: 5rem;
} }
.count-up .material-icons { .count-up .material-icons {
font-size: 20vh; font-size: 7rem;
line-height: 25vh; line-height: 8rem;
} }
.count-down .material-icons { .count-down .material-icons {
font-size: 10vh; font-size: 4.5rem;
line-height: 12.5vh; line-height: 5rem;
} }
.inline-block { .inline-block {

View file

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

View file

@ -1,8 +1,22 @@
#!/usr/bin/env python #!/usr/bin/env python
import os import os
import sys import sys
from dotenv import load_dotenv
from os import path
if __name__ == '__main__': 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') os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'arrowcounter.settings')
try: try:
from django.core.management import execute_from_command_line from django.core.management import execute_from_command_line

View file

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