This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
How to use url_for with routers and shared templates/static files #2698
Labels
You can continue the conversation there. Go to discussion →
First check
Description
I would like to use the following organisation :
for API routers, everything seems to work fine.
But I have some issues with the dhs part.
main.py hosted some functions which have to render templates, as well as dhs.py.
But as I want to host my templates/static files in only place, I've let them in the templates and static folders as described above.
Here are the code i'm using within main.py and dhs.py :
main.py
dhs.py
But with this, as I'm using some url_for which points to functions in dhs.py, it fails with the following error :
for the url_for, I've tried multiple options :
But nothing seems to work.
Am I missing something ?
What could be the issue ?
What would the Best Practices in order to use shared templates/static files with multiple routers ?
Thanks a lot for your support.
Environment
OS: Tiangolo FastAPI docker.
Python version:
# python --version Python 3.7.7
The text was updated successfully, but these errors were encountered: