开发者

Loading A CSS File From Django Template

I have looked through several answers for loading CSS pages. http://docs.djangoproject.com/en/dev/howto/static-files/

Basically, I believe my question should be how do I get staticfiles installed?

I am confused about the settings in settings.py, and I get this error when trying to run collectstatic.

./manage.py collectstatic
Unknown开发者_如何学C command: 'collectstatic'

In settings.py, I've added

'django.contrib.staticfiles',

to INSTALLED_APS

and

STATICFILES_DIRS = (
 "/home/amr/django/static_media",
)

STATIC_ROOT = "/home/amr/django/static_media"

The error I'm getting is there is no module staticfiles.


That documentation is for the development version of Django. If you're running a stable version then you should examine the appropriate docs by clicking on the version number at the top of the article.


Try running it with sudo. Available commands are limited based on your access level.


It seems like you are running an old version of django, the staticfiles application is included in the latest 1.3-alpha or trunk version. To find out which version of django your project is running on try running the following command on a shell

$ python -c "import django; print django.get_version()"


It's worth noting that the docs for 1.2 here:

http://docs.djangoproject.com/en/1.2/howto/static-files/

are the same as 1.3

however, this is obviously totally wrong.

So the first answer here is frustratingly misleading.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜