Internal server error when running

internal server error when running

But we need more information to be able to help.

  • When does this error occur?
  • Directly?
  • Or after start but as soon as you do something?
    The traceback use to point out where the problem are.
  • Have you tried to change something on this or around this row?
  • Have you Google this problem?
  • What answer do other get when posting this question?

If you dont find any useful you can of course put in your code here on this forum.

Paste your code between those ”code” words within square brackets.

 Paste your code in here. 
from flask import Flask
from flask import render_template
from flask import request

app = Flask(__name__, template_folder="templates/")

@app.route("/hello", methods=['POST', 'GET'])
def index():
    greeting = "Hello World"

    if request.method == "POST":
        name = request.form['name']
        greet = request.form['greet']
        greeting = f"{greet}, {name}"
        return render_template("index.html", greeting=greeting)
        return render_template("hello_form.html")

if __name__ == "__main__":

thank you for taking the time to help

Hi @ailsagy.

I first must say there perhaps are some formating error when you put up your code.
If you didn’t. Please include your all of your code between


I have never seen anything else than:

app = Flask( __name__)


if __name__ == "__main__":

When I have this structure:

ex51/ templates/

I got your code running when removing text in bold:

app = Flask( name, template_folder=“templates/”)

I have never seen this before.
Is it necessary?

Hey @ailsagy, follow these instructions and turn on development mode:

This will give you better output on what’s wrong.

A free service run by Zed A. Shaw for