Question : flask define template folder
Answered by : smiling-serval-gcb4hcqvpipe
import os
from flask import Flask
template_dir = os.path.abspath('../../frontend/src')
app = Flask(__name__, template_folder=template_dir)
Source : https://stackoverflow.com/questions/31002890/how-to-reference-a-html-template-from-a-different-directory-in-python-flask/31003097 | Last Update : Sun, 18 Jul 21
Question : how to change templates folder in flask
Answered by : sahil-bhatt
app = Flask(__name__, template_folder='/content/gdrive/MyDrive/test')
@app.route('/')
def home(): return render_template('test.html')
Source : https://stackoverflow.com/questions/66030868/error-rendering-html-template-with-flask-and-google-colab | Last Update : Sat, 30 Jul 22
Question : flask templates folder static folder
Answered by : tibor-polyk
my-flask-app ├── static/ │ └── css/ │ └── main.css ├── templates/ │ ├── index.html │ └── student.html ├── data.py └── students.py
Source : https://python-adv-web-apps.readthedocs.io/en/latest/flask3.html | Last Update : Wed, 16 Nov 22