when I run it on the browser (chrome) I get:
"500 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."
here is the code:
from flask import Flask, render_template
app=Flask(__name__)
@app.route('/')
def home():
return "hello world"
@app.route('/welcome')
def welcome():
return render_template("welcome.html")
if __name__ == '__main__':
app.run(debug=True)
Here is the welcome.html file which is in the templates directory:
<!DOCTYPE html>
<html>
<head>
<title>Flask Intro</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="static/bootstrap.min.css" rel="stylesheet" media = "screen">
</head>
<body>
<div class="container">
<h1>Welcome to Flask!</h1>
<br>
<p>Click <a href="/">here</a>to go home.</p>
</div>
</body>
</html>
I'm using Python anywhere for this project. When I try the other route ('/'), it works, which means it's only a problem with the render_template route.
Aucun commentaire:
Enregistrer un commentaire