Hi,
The css file is in .../polls/static/polls/style.css
And here is the full code of .../polls/templates/polls/index.html:
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static 'polls/style.css' %}" />
{% if latest_question_list %}
<ul>
{% for question in latest_question_list %}
<li><a href="{% url 'polls:detail' question.id %}">{{ question.question_text }}</a></li>
{% endfor %}
</ul>
{% else %}
<p>No polls are available.</p>
{% endif %}
And this is the PowerShell I get when opening the webpage:
[30/May/2018 17:26:42] "GET /polls/ HTTP/1.1" 200 169
[30/May/2018 17:26:42] "GET /polls/static/polls/style.css HTTP/1.1" 404 1681
Not Found: /favicon.ico
[30/May/2018 17:26:43] "GET /favicon.ico HTTP/1.1" 404 2088
-Mikko
2018-05-30 2:16 GMT+03:00 Vijay Khemlani <vkhemlan@gmail.com>:
That's only for production environments, for development you don't need to run that commandWhere did you finally put the css file and what path did you put in the <link> tag?--On Tue, May 29, 2018 at 1:46 PM Mikko Meronen <mikkovillemeronen@gmail.com> wrote:To view this discussion on the web visit https://groups.google.com/d/Hi,Thank you, but I should have those correct.I did some googling and ran following: python manage.py collectstaticAnd I got this:Django-project\lib\site-packages\django\contrib\ staticfiles\storage.py", line 43, in path raise ImproperlyConfigured("You're using the staticfiles app "django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path. If any advices available, I would appreciate it a lot, thank you.-Mikko--2018-05-29 10:18 GMT+03:00 s.f.wrobel via Django users <django-users@googlegroups.com> :--Make sure that you add the following line to your settings.py:INSTALLED_APPS = ['YOUR_APP_NAME','django.contrib.admin','django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.messages','django.contrib.staticfiles',]In your case YOUR_APP_NAME should be polls.Only with this line set, django looks in polls/static/polls/ for static (e.g .css) files.
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 https://groups.google.com/group/django-users .
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1ce28246- .ddf6-48b2-9811-988678beb65c% 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+unsubscribe@googlegroups.com .
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users .msgid/django-users/ .CAGD0jjJUHeZD2ep52j- NArHPjEibVMK3Jiiqor4O4BEuS2_ gtw%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 https://groups.google.com/group/django-users .
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ .CALn3ei2ujyB0g4fV-Ow2ogcgkv8% 3D_XfvK2rzHTtfPjGAyJz%3DAQ% 40mail.gmail.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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGD0jjLyHF_NCtSFRRYZ18CViNDvPb81S78%2BYcV7zKyAfSxj-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment