Python code:
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
def hello():
return render_template('testing.html')
if __name__ == "__main__":
app.run()
Html file:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1>My name is pk</h1>
</body>
</html>
Also how to enable jinja2 in pycharm community version. I am directly creating html file and .py file in the same project
flask file structure
|-app
|--templates // where your html files must be in
|--static // where your js and css files must be in
|--.py files
|--other packages
Also jinja is enabled in your system, if you have already downloaded flask package.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With