diff --git a/.env.debug b/.env.debug new file mode 100644 index 0000000..f7e3cad --- /dev/null +++ b/.env.debug @@ -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 diff --git a/arrowcounter/settings.py b/arrowcounter/settings.py index 124570e..e0dff80 100644 --- a/arrowcounter/settings.py +++ b/arrowcounter/settings.py @@ -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', diff --git a/counter/static/css/main.css b/counter/static/css/main.css index feec187..3dbcb6a 100644 --- a/counter/static/css/main.css +++ b/counter/static/css/main.css @@ -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 { diff --git a/counter/templates/base.html b/counter/templates/base.html index ad1a855..3401917 100644 --- a/counter/templates/base.html +++ b/counter/templates/base.html @@ -7,9 +7,12 @@ {% block title %}{% endblock %} | Arrow Counter - - - + + + {% block style %}{% endblock %} diff --git a/manage.py b/manage.py index 15fb375..4b87bae 100755 --- a/manage.py +++ b/manage.py @@ -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 diff --git a/requirements.txt b/requirements.txt index d3e4ba5..f3efb65 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ django +python-dotenv