diff --git a/.gitignore b/.gitignore index dad9412..8a65c4a 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,5 @@ target/ .elasticbeanstalk/* !.elasticbeanstalk/*.cfg.yml !.elasticbeanstalk/*.global.yml + +.idea diff --git a/app/app/views.py b/app/app/views.py index aa24b5f..bbaab39 100644 --- a/app/app/views.py +++ b/app/app/views.py @@ -14,23 +14,29 @@ def home(request): page_load = PageLoad() - page_load.save() - page_loads = [model.format_datetime() for model in PageLoad.objects.all()] - return render(request, "home.html", {'page_loads':page_loads}) + # page_load.save() + # page_loads = [model.format_datetime() for model in PageLoad.objects.all()] + + # return render(request, "home.html", {'page_loads':page_loads}) + return render(request, "home.html") # This block of code checks for changes to your code every five seconds # and reloads the app if there are changes. This only runs in dev mode. if settings.ENVIRONMENT == 'development' and 'TRAVIS' not in os.environ: - import uwsgi - from uwsgidecorators import timer - from django.utils import autoreload - - @timer(5) - def reload_uwsgi_on_code_change(sig): - """This function will check every five seconds to see whether - the Django code has changed, and if it has uWSGI will reload. - This mimics the autoreload functionality - of manage.py runserver.""" - if autoreload.code_changed(): - uwsgi.reload() + try: + import uwsgi + except ImportError as e: + print('Unable to do automatic reload') + else: + from uwsgidecorators import timer + from django.utils import autoreload + + @timer(5) + def reload_uwsgi_on_code_change(sig): + """This function will check every five seconds to see whether + the Django code has changed, and if it has uWSGI will reload. + This mimics the autoreload functionality + of manage.py runserver.""" + if autoreload.code_changed(): + uwsgi.reload()