-1

I've decided to introduce with flask. I started with HelloWorld-page:

main.py:

from flask import Flask, render_template
app = Flask(__name__)


@app.route('/')
def hello_world():
    return render_template('index.html')


app.run()

index.html (in the same directory with main.py):

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Main</title>
</head>
<body>
    <h1>Hello, World!</h1>
</body>
</html>

But when I open 127.0.0.1:5000, I get

Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

Help, please

1 Answers1

1

Make a directory named templates and move index.html there. That's where Flask looks for template files.

dvnguyen
  • 2,954
  • 17
  • 24