Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,5 @@ target/
.elasticbeanstalk/*
!.elasticbeanstalk/*.cfg.yml
!.elasticbeanstalk/*.global.yml

.idea
36 changes: 21 additions & 15 deletions app/app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()