Let's say I have a Flask application where
app = Flask(__name__, static_url_path='')
That is, {{ STATIC_URL }} == ""
(empty string) and the static files are not stored under a dedicated /static
directory (e.g. http://www.example.com/img/logo.png
instead of http://www.example.com/static/img/logo.png
)
Is it ok if I just leave it this way? The GET requests to any URL that contains {{ STATIC_URL }}
give a 304
redirect instead of a 200
status code if I leave the variable in my code.
Is it necessary to:
{{ STATIC_URL }}
in my templates?{{ STATIC_URL }}
in my templates so that I can set a new static directory in the future if necessary?HTTP response 304 is for "Redirection to a previously cached result".
This means Flask is telling your browser that it already has the content.
Clear your Browser cache and you will notice that Flask returns a 200 on your next request.
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