-1

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.

Kaow
  • 483
  • 2
  • 9
  • 22

1 Answers1

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