Added high-quality error pages

This commit is contained in:
Dominik V. Salonen 2015-12-26 20:32:42 +01:00
parent feb5f3abb9
commit ec85d97a13
1 changed files with 10 additions and 0 deletions

10
run.py
View File

@ -140,6 +140,16 @@ def get_file(filename):
def serve_legacy(filename): def serve_legacy(filename):
return send_from_directory('legacy', filename) return send_from_directory('legacy', filename)
# Configure nginx to use these urls as custom error pages
@app.route('/error/<int:error>')
def nginx_error(error):
if error == 413:
return error_page("O-o-onii-chan, noo it's too big ~~"), 413
else:
error_page("We literally have no idea what just happened")
cleaner = Thread(target = cleaner_thread, ) cleaner = Thread(target = cleaner_thread, )
cleaner.start() cleaner.start()
if __name__ == '__main__': if __name__ == '__main__':