You can't use the same tags for loading the staticfiles and the static
method. However you should be able to load the file via:
https://stackoverflow.com/a/43295624
But the next question is what is it you want to achieve? Why do you need to
load the static file in the view itself?
Regards,
André
hi Guy,
What's the structure of your project and the content of your settings.py?
Le mer. 25 déc. 2019 à 12:32, Guy NANA a écrit :
> I want to access static files in views.py but it doesn't work when I use
> {% load static %} and {% static relative_path %} in the same way like in a
> template.
Hi,
Make sure these requirements:
https://docs.djangoproject.com/en/3.0/howto/static-files/
On Wed, Dec 25, 2019, 19:32 Guy NANA wrote:
> I want to access static files in views.py but it doesn't work when I use
> {% load static %} and {% static relative_path %} in the same way like in a
> templ
3 matches
Mail list logo