Problem about 500 Internal Server Error in Python Flask Problem about 500 Internal Server Error in Python Flask flask flask

Problem about 500 Internal Server Error in Python Flask


Whenever we receive 500 internal server error on a Python wsgi application we can log it using 'logging'

First import from logging import FileHandler,WARNING

then after app = Flask(__name__, template_folder = 'template')add

file_handler = FileHandler('errorlog.txt')file_handler.setLevel(WARNING)

Then you can run the application and when you receive a 500 Internal server error, cat/nano your errortext.txt file to read it, which will show you what the error was caused by.


You can try this below by adding the type string in your @app.route :

@app.route("/profile/<string:name>")def profile(name):  return render_template("test.html", name=name)


  1. You must not had an empty line beetween@app.route("/profile/<name>") and def profile(name):

  2. You have to set the html file in a folder called templates.

  3. You have to set the templates folder and run.py in the same folder