Tuesday, January 6, 2015

Re: Serving static files and media in Django 1.7.1

Thanks @Vijay! Can't believe that caught me out like that.

Regards,
Sithu

On Wed, Jan 7, 2015 at 1:34 AM, Vijay Khemlani <vkhemlan@gmail.com> wrote:
the static tag should be 

{% static 'mainsite/bootstrap.css' %}

according to the layout you said

On Tue, Jan 6, 2015 at 8:30 PM, Sithembewena Lloyd Dube <zebra05@gmail.com> wrote:
Hi everyone,

I have a Django 1.7.1 project structured as per documentation. In it, I have an app called "mainsite". In mainsite, I have templates/mainsite/index.html and static/mainsite/bootstrap.css. In the index template, I use {% load staticfiles %} and then for css I have the following link: <link href="{% static "css/bootstrap.css" %}" rel="stylesheet"> However, when I load the page in the browser, the css does not load and when in "view source" mode, I click the link href ("/static/css/bootstrap.css"). This generates a 404 error.

What am I missing? Any suggestions welcome.

P.S: I have the STATIC_URL = '/static/' setting defined in the settings file.

--
Regards,
Sithu Lloyd Dube

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAH-SnCBJamc9ZKzmy3y63fAo5n7p7xT6G8oAiu%3DFUbjM-KF%2Bbw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALn3ei1gt%2BKmk9zU%3DGRuR8DFxmYiwyQ_cF%2Ba9fMTgMk3Vg0nmA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--
Regards,
Sithu Lloyd Dube

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAH-SnCBeXSMWjKkr5WojN8%3DDSq3hn5%2B27jwqgEZvD65N_jeeOg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment