Wednesday, February 5, 2014

Re: tutorial p.6 problem: style.css isn't loaded

templates/admin isn't necessary. Instead you should extend both TEMPLATE_DIRS and STATICFILES_DIRS to include the templates and static files for the admin package:

TEMPLATE_DIRS = (
    os.path.join(BASE_DIR, 'templates'),
    '/opt/python-venv/lib/python2.7/site-packages/django/contrib/admin/templates/',
)
STATICFILES_DIRS = (
    '/opt/python-venv/lib/python2.7/site-packages/django/contrib/admin/static/',
)



On Wed, Feb 5, 2014 at 9:45 AM, Janek Warchoł <lemniskata.bernoullego@gmail.com> wrote:
Hello,

i'm following Django's tutorial (very nice, btw) and static files don't work for me.  I have a test project created along the previous parts of the tutorial, and now i'm here: https://docs.djangoproject.com/en/1.6/intro/tutorial06/#customize-your-app-s-look-and-feel

According to instructions, I've added a style.css file to BASE_DIR/polls/static/polls/ subdir and inserted

{% load staticfiles %}

<link rel="stylesheet" type="text/css" href="{% static 'polls/style.css' %}" />

into my polls/templates/polls/index.html - however, it doesn't have any effect (i.e. the links in the poll list aren't green), and when i look into the shell where Django development server is running, i see

"GET /static/polls/style.css HTTP/1.1" 404 1649

so, it seems that the file cannot be accessed at all.  But i'm at a loss of why it doesn't work :(

Any ideas?
If anyone wants to look at my code, it's here:
https://github.com/j-warchol/django-test

best,
Janek

--
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/CABmDZEObsanqcDVBC9-R%3DiVen4eocRFcFc16oXHwkQY5PUPr7A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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/CALLzXtQzsMEkOWMTS1ANk-YohPc2QfHRxG21m7vTK5CyjH0cWw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment