With staticfiles_urlpatterns: "Empty static prefix not permitted"

I am very new to Python and Django, and I am sorry if this is a really stupid question. I couldn't find a solution in the forum or Google.

I followed the tutorial on:

Everything went fine until I modified Enabling the two lines

20 from django.contrib.staticfiles.urls import staticfiles_urlpattern
21 urlpatterns += staticfiles_urlpatterns()

gives me an Exception: ImproperlyConfigured, Empty static prefix not permitted

Disabling the two lines things work, but I dont get the admin css.

This is how my looks like:

1 from django.conf.urls.defaults import patterns, include, url
3 # Uncomment the next two lines to enable the admin:
4 from django.contrib import admin
5 admin.autodiscover()
7 urlpatterns = patterns('',
8 # Examples:
9 # url(r'^$', 'HIT.views.home', name='home'),
10 # url(r'^HIT/', include('')),
12 # Uncomment the admin/doc line below to enable admin documentation:
13 # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
15 # Uncomment the next line to enable the admin:
16 url(r'^admin/', include(,
17 )
19 # Uncomment these two lines to enable your static files on PythonAnywhere
20 from django.contrib.staticfiles.urls import staticfiles_urlpatterns
21 urlpatterns += staticfiles_urlpatterns()

What am I doing wrong?

What does your looks like? Do you have DEBUG enabled?

DEBUG is enabled.

The following are the lines I changed in


'default': {

    'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.

    'NAME': '******',                      # Or path to database file if using sqlite3.

    'USER': '******',                      # Not used with sqlite3.

    'PASSWORD': '********',                  # Not used with sqlite3.

    'HOST': 'mysql.server',                      # Set to empty string for localhost. Not used with sqlite3.

    'PORT': '',                      # Set to empty string for default. Not used with sqlite3.












Hi again,

I just found the problem. I actually had copied the file from a different project, and the STATIC_* variables were missing.

Stupid me. Sorry for bothering you!

Great, everything works like a charm! :) Have a nice weekend and a happy new year!

Excellent. Glad you got it working.