When i have set file path in href tag like this <a href="/static/file">
which is work normally in localhost but when deploy the application in windows server (FastCGI), it error because not found the file path, so what is a problem and how to fix it.
Asked
Active
Viewed 36 times
-1

Kaow
- 483
- 2
- 9
- 22
-
I think you should setup your server to handle the static files, not flask itself. – Mihail Feraru Mar 25 '20 at 08:32
1 Answers
0
When using Flask
framework, I suggest in using Jinja2
template mechanism which allows you to point what file you need to retrieve, present and etc., so in your case, you could write in the HTML
template like this:
<a href="{{ url_for('static', filename='<file_path_after_static_dir>') }}">
But for more information, I would offer to read official documentation on how to work with Flask
and Jinja2
templates.
You have to have a proper structure of
Flask
project in order to work properly with templates, static files,Jinja2
template.

simkusr
- 770
- 2
- 11
- 20