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 :: random word generator django 
Python :: multiply every nth element 
Python :: np.nditer 
Python :: sowpods python 
Python :: Return an RDD created by coalescing all elements within each partition into a list. 
Python :: new column in pandas with where logic 
Python :: what is mi casa in spanish 
Python :: assign multiple vabies in one line 
Python :: Limits the result count to the number specified 
Python :: numpy stack in new dimension 
Python :: convert excel cellname to index python 
Python :: raspberry pi pygame play thru bluetooth device 
Python :: mask and then fillnan# 
Python :: how to use Py-agender for projects 
Python :: comment a lot of lines python vscode 
Python :: dont squeeze plot when creating colorbar matplotlib 
Python :: python args description multiple lines 
Python :: how to subtract numbers in python 
Python :: how to form a list from a file in python 
Python :: indentation error python 
Python :: Circular heatmap python 
Python :: python input text in file 
Python :: compute the average age for each gender? * 
Python :: arrow.get(null) 
Python :: zipfian distribution python 
Python :: spacy print word in vocab 
Python :: exercise of python loops 
Python :: python enumerate list with comprehension 
Python :: assign more than one variable at a time on a single line in python 
Python :: df filter out rows that appear more than x times 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =