Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

custom 404 page flask

from flask import render_template

@app.errorhandler(404)
def page_not_found(e): # e must be in there
    # note that we set the 404 status, this is what it catches
    return render_template('404.html'), 404
Comment

flask return 404

I had the same issue. I had it because I changed the parameters SERVER_NAMEof the config to a name which is not the name of the server.

You can solve this bug by removing SERVER_NAME from the config if you have it.
Comment

PREVIOUS NEXT
Code Example
Python :: pandas read_csv random rows 
Python :: how to find where python is located 
Python :: add favicon fastapi 
Python :: how to install panda3D 
Python :: generate random characters in python 
Python :: python input separated by 
Python :: why when I merge my label cluster with my dataframe i get more row 
Python :: django admin slug auto populate 
Python :: add self role with discord bot python 
Python :: remove column from dataframe 
Python :: rotate matrix 90 degrees clockwise python 
Python :: python roll dice 100 times 
Python :: chech box in tkinter 
Python :: normalize column pandas 
Python :: stop a function from continuing when a condition is met python 
Python :: rename the console python 
Python :: python load pandas from pickle 
Python :: bs4 from url 
Python :: django return only part of string 
Python :: python datetime minus days 
Python :: python connect sftp with key 
Python :: set seed python 
Python :: Solving environment: failed with initial frozen solve. retrying with flexible solve 
Python :: np.random.seed 
Python :: python blackjack 
Python :: regex to find ip address python 
Python :: if a number times a number is true python 
Python :: python folium add minimap to map 
Python :: pandas show complete string 
Python :: dashes seaborn 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =