The import staticfiles_urlpatterns is not working in django 1.3

506 views
Skip to first unread message

Guevara

unread,
Apr 21, 2011, 1:48:49 PM4/21/11
to Django users
Hello!
My project is failing to import the staticfiles_urlpatterns, using
Eclipse Helios:

urls.py

import from django.contrib.staticfiles.urls staticfiles_urlpatterns

In django 1.3 I already have:

INSTALLED_APPS = (
'django.contrib.staticfiles'
)

In the folder:
/ usr/local/lib/python2.6/dist-packages/django/contrib/staticfiles

Why do not you think the staticfiles_urlpatterns?

Thanks!

Guevara

unread,
Apr 21, 2011, 7:56:19 PM4/21/11
to Django users
The problem was the documentation, the manual of utilization says one
thing, but the Contrib documentation says another, I follow contrib
doc:

This is the configuration that worked:

settings.py


STATIC_ROOT = ''
STATIC_URL = '/static/'

STATICFILES_DIRS = (
"/home/guevara/workspace/imobiliaria/static",
)
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.static',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
)

And call CSS in base.html:

<link href="{{ STATIC_URL }}css/style.css" rel="stylesheet" type="text/
css" media="screen" />

Thanks!

Brian Neal

unread,
Apr 21, 2011, 7:58:57 PM4/21/11
to Django users
Please post your code and the exact error. For one thing, your import
statement isn't valid Python. It should be:

from django.contrib.staticfiles.urls import staticfiles_urlpatterns

Best,
BN

Ernesto Guevara

unread,
Apr 21, 2011, 9:24:19 PM4/21/11
to django...@googlegroups.com
Hello Brian!
This right, in fact that word "import" I inadvertently pasted, but the import does not work.

from django.contrib.staticfiles.urls import staticfiles_urlpatterns

The problem was that when doing the import, it does not appear available by pressing ctrl + backspace in Eclipse, that is, the import does not exist.

In fact, not need it, and even configure the urls.py.
With the configuration that I have informed the css work

Thanks!


2011/4/21 Brian Neal <bgn...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


Reply all
Reply to author
Forward
0 new messages