Commit 9594eac5 authored by Julien Enselme's avatar Julien Enselme

Add dynamic pages

parent 2c4eab9a
from django.http import Http404
from django.shortcuts import render
......@@ -15,6 +16,7 @@ def say_something(request, key):
'bye': 'Have a nice day',
}
thing = things_to_say.get(key, '')
if key not in things_to_say:
raise Http404(f'{key} is not a valid thing to say')
return render(request, 'pwa/say_something.html', context={'thing': thing})
return render(request, 'pwa/say_something.html', context={'thing': things_to_say[key]})
......@@ -25,7 +25,7 @@ SECRET_KEY = '(nponxj8^arqne3g#+shmu$rxn+^lok%jkk6d0cu&%4srt(4!('
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
ALLOWED_HOSTS = ['*']
# Application definition
......
{% extends 'base.html' %}
{% block title %}Not Found{% endblock %}
{% block body %}
<h1>Page not found</h1>
<p>We're sorry but this page doesn't exist.</p>
{% endblock %}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment