1

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.

4 Answers 4

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

This is where I load the css file in my base template<html> <!-- Test Comment --> <head> <title>{% block title %}Town of Arlington Water Department AMR System{% endblock %} </title> <link rel="stylesheet" type="text/css" href="/static_media/amr.css" /> </head> This is the css file (for now) body{ background-color: gray;} p { color: blue; } h3{ color: white; } I've added this to urls.py (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/home/amr/django'}), Where can I check to see why this is not loading?
Thanks for your answer. I looked for the 1.2.3 documentation.
2

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

Comments

1

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

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.