#29034: App Configs do not correctly handle static files
-------------------------------------+-------------------------------------
               Reporter:  nanomebia  |          Owner:  nobody
                   Type:  Bug        |         Status:  new
              Component:             |        Version:  2.0
  contrib.staticfiles                |       Keywords:  staticfiles
               Severity:  Normal     |  appconfigs
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 When following along with the djagno Polls tutorial I noticed the
 following behavior:

 In tutorial 6 we learn about static files, and about how to correctly
 include them in our polls app. Following along with the tutorial exactly
 however leads us to a situation where the static files are not correctly
 included in the application and therefore our style.css does not get
 imported to our application.

 The issue lies in tutorial 2 - where we first included our polls app in
 settings.py via INSTALLED_APPS:
 {{{#!python
 INSTALLED_APPS = [
     'polls.apps.PollsConfig',
     'django.contrib.admin',
     'django.contrib.auth',
     'django.contrib.contenttypes',
     'django.contrib.sessions',
     'django.contrib.messages',
     'django.contrib.staticfiles',
 ]
 }}}

 Using this method, static files do not get correctly imported to the app
 for inclusion in templates/etc

 To fix this in the polls application, modifying INSTALLED_APPS as below
 produces the expected behavior (static files get included and can be
 accessed via templates.
 {{{#!python
 INSTALLED_APPS = [
     'polls',
     'django.contrib.admin',
     'django.contrib.auth',
     'django.contrib.contenttypes',
     'django.contrib.sessions',
     'django.contrib.messages',
     'django.contrib.staticfiles',
 ]
 }}}

 According to apollo13 this seems to be a bug with handling of static files
 with app configs.

 A quick fix for the tutorials may be changing the include text to just be
 "polls" vs "polls.apps.PollsConfig" however this may not be the desired
 syntax for app config includes.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29034>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.1d7a6f7911d61357621bc75b205e0a7a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to