﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
29034	App Configs do not correctly handle static files	nanomebia	nobody	"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."	Bug	closed	contrib.staticfiles	2.0	Normal	worksforme	staticfiles appconfigs	Florian Apolloner	Unreviewed	0	0	0	0	0	0
