added 404 handling
This commit is contained in:
parent
b9f474601b
commit
fe32def7c2
3 changed files with 23 additions and 14 deletions
4
app.py
4
app.py
|
|
@ -33,4 +33,8 @@ def remove():
|
|||
file.truncate()
|
||||
except ValueError: # Don't crash trying to delete already deleted thing
|
||||
pass
|
||||
return redirect(url_for('index'))
|
||||
|
||||
@app.errorhandler(404)
|
||||
def page_not_found(error):
|
||||
return redirect(url_for('index'))
|
||||
16
templates/base.html
Normal file
16
templates/base.html
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Shopping List</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css') }}">
|
||||
<link rel="shortcut icon" type="image/ico" href="{{ url_for('static', filename='icon.ico') }}">
|
||||
|
||||
<script>0</script>
|
||||
</head>
|
||||
<body>
|
||||
{% block content %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,16 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Shopping List</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
{% extends 'base.html' %}
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css') }}">
|
||||
<link rel="shortcut icon" type="image/ico" href="{{ url_for('static', filename='icon.ico') }}">
|
||||
|
||||
<script>0</script>
|
||||
</head>
|
||||
<body>
|
||||
{% block content -%}
|
||||
<h1>
|
||||
Shopping List
|
||||
</h1>
|
||||
|
|
@ -29,5 +19,4 @@
|
|||
<button><span>+</span></button>
|
||||
<input type="text" name="item" autocomplete="off" autofocus>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
{%- endblock %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue