That shouldn't be necessary, as the tutorial has you put the CSS file into the static directory in your polls app, not your project. Static files in your polls app should be found with the default settings:
Django'sSTATICFILES_FINDERSsetting contains a list of finders that know how to discover static files from various sources. One of the defaults isAppDirectoriesFinderwhich looks for a "static" subdirectory in each of theINSTALLED_APPS, like the one inpollswe just created. The admin site uses the same directory structure for its static files.
My guess is that you put your CSS file at static/polls/style.css (relative to BASE_DIR) instead of polls/static/polls/style.css
Hope that helps,
Daniel
On Tue, Aug 21, 2018 at 2:01 PM Alesh Houdek <mail@alesh.com> wrote:
--I'm doing the Django tutorial and got stuck on the static files section: https://docs.djangoproject.com/en/2.1/intro/tutorial06/#customize-your-app-s-look-and-feelCould not get the style.css file to work despite triple-checking everything.After much research, I got it to work by adding this to settings.py:STATICFILES_DIRS = ( os.path.join(BASE_DIR, "static"), )
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/f5e58b12-a8d2-4ad2-983b-856895a91eb4%40googlegroups.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/CAHEnUVX33dr9di4doSe0_gqzdTEzK%3DsWtujR7%3DiUTJmUK_ysng%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment