Changeset - 1cccf4eef19c
[Not reviewed]
default
0 2 1
Dennis Fink - 11 years ago 2014-01-29 11:03:19
dennis.fink@c3l.lu
added custom 404 page
3 files changed with 16 insertions and 5 deletions:
0 comments (0 inline, 0 general)
ennstatus/__init__.py
Show inline comments
 
from flask import Flask, redirect, url_for
 
from flask import Flask, render_template
 
from flask_bootstrap import Bootstrap
 
from flask.ext.compress import Compress
 
#from flask_sslify import SSLify
 

	
 
from ennstatus.log import init_logging
 

	
 
@@ -13,22 +13,22 @@ Compress(app)
 
#SSLify(app, permanent=True)
 

	
 
from ennstatus.views import root_page
 
from ennstatus.api.views import api_page
 
from ennstatus.donate.views import donate_page
 
from ennstatus.status.views import status_page
 
#from ennstatus.stats.views import stats_page
 
from ennstatus.stats.views import stats_page
 

	
 
app.register_blueprint(root_page)
 
app.register_blueprint(api_page, url_prefix='/api')
 
app.register_blueprint(donate_page, url_prefix='/donate')
 
app.register_blueprint(status_page, url_prefix='/status')
 
#app.register_blueprint(stats_page, url_prefix='/stats')
 
app.register_blueprint(stats_page, url_prefix='/stats')
 

	
 

	
 
@app.errorhandler(404)
 
def page_not_found(e):
 
    return redirect(url_for('donate.index'))
 
    return render_template('errorpages/404.html')
 

	
 
init_logging(app)
 

	
 
application = app
ennstatus/templates/errorpages/404.html
Show inline comments
 
new file 100644
 
{% extends "base.html" %}
 

	
 
{% set title = "404 - Not found" %}
 

	
 
{% block content %}
 
  <div class="col-md-12">
 
    <h1>404 - Not found!</h1>
 
    <p>Sorry, but the page you are looking for has not been found. Try checking your URL for errors, then hit the refresh button on your browser!</p>
 
  </div>
 
{% endblock %}
setup.py
Show inline comments
 
@@ -28,13 +28,14 @@ setup(name='Ennstatus',
 
                                  'static/videos/*',
 
                                  'templates/*.html',
 
                                  'templates/api/export/xml/*.xml',
 
                                  'templates/donate/*.html',
 
                                  'templates/root/*.html',
 
                                  'templates/status/*.html',
 
                                  'templates/stats/*.html'
 
                                  'templates/stats/*.html',
 
                                  'templates/errorpages/*.html',
 
                                  ]},
 
      install_requires=_get_requirements(),
 
      classifiers=['Development Status :: 5 - Production/Stable',
 
                   'Environment :: Web Environment',
 
                   'Operating System :: POSIX',
 
                   'Programming Language :: Python',
0 comments (0 inline, 0 general)