nicer 404 and missing page redirects
This commit is contained in:
parent
f655943898
commit
fa0a6461d4
|
@ -1,7 +1,7 @@
|
||||||
import json
|
import json
|
||||||
from os import makedirs
|
from os import makedirs
|
||||||
from flask import Flask, request, session
|
from flask import Flask, request, session, redirect
|
||||||
from flask import render_template, flash
|
from flask import render_template, flash, url_for
|
||||||
from flask_session import Session
|
from flask_session import Session
|
||||||
from suchwow import config
|
from suchwow import config
|
||||||
from suchwow.models import Post, Profile, Comment, Notification, db
|
from suchwow.models import Post, Profile, Comment, Notification, db
|
||||||
|
@ -41,7 +41,8 @@ def about():
|
||||||
|
|
||||||
@app.errorhandler(404)
|
@app.errorhandler(404)
|
||||||
def not_found(error):
|
def not_found(error):
|
||||||
return "nothin there, brah"
|
flash("nothing there, brah")
|
||||||
|
return redirect(url_for("index"))
|
||||||
|
|
||||||
@app.cli.command("init")
|
@app.cli.command("init")
|
||||||
def init():
|
def init():
|
||||||
|
|
|
@ -46,7 +46,8 @@ def read(id):
|
||||||
transfers=transfers
|
transfers=transfers
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return "no meme there brah"
|
flash("No meme there, brah")
|
||||||
|
return redirect(url_for("index"))
|
||||||
|
|
||||||
@bp.route("/post/create", methods=["GET", "POST"])
|
@bp.route("/post/create", methods=["GET", "POST"])
|
||||||
@login_required
|
@login_required
|
||||||
|
|
Loading…
Reference in New Issue