Re: How to access static files in views.py

2019-12-26 Thread Andréas Kühne
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éas


Den ons 25 dec. 2019 kl 13:32 skrev Guy NANA :

> 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.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8b8d6254-f0f4-4e2f-8b4d-1c4bde5dc050%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK4qSCfPY95xtPwcdy0hEpey76hogZSps4tnrq%2B-S35bVSRV0w%40mail.gmail.com.


Re: How to access static files in views.py

2019-12-26 Thread Damby Green
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.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8b8d6254-f0f4-4e2f-8b4d-1c4bde5dc050%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABpTzbVLzxjwh%3DZUQ-foncjDO1xtPM7MhvR7RgYr_Kc4jAA2NA%40mail.gmail.com.


Re: How to access static files in views.py

2019-12-25 Thread Integr@te System
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
> template.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8b8d6254-f0f4-4e2f-8b4d-1c4bde5dc050%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP5HUWqq-m%3D%2BoGMNoczCCabhbmieTbZEw9WQt-xxhU-JOxAW1Q%40mail.gmail.com.