octopusgrabbus
octopusgrabbus

Reputation: 10685

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 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.

Upvotes: 1

Views: 2449

Answers (4)

Dmitry
Dmitry

Reputation: 2138

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

Upvotes: 2

asldfkjasdlfjapsdl
asldfkjasdlfjapsdl

Reputation: 11

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.

Upvotes: 1

vinilios
vinilios

Reputation: 871

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()"

Upvotes: 1

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798486

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.

Upvotes: 2

Related Questions