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.

Answers


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

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


Need Your Help

ASP.Net LINQ to SQL group by syntax for System.Generic.IEnumerable Collection

asp.net linq-to-sql group-by

.Net application calls Stored Procedure and returns collection which is stored as 'result.' I want to be able to group the results by 'CreatorLineOfBusinessID'. It returns that field along with s...

Problem between context and thread in drawRect

objective-c multithreading ios uiview drawrect

I'm trying to draw a couple of UIImages in a UIView, and I'm doing it by hand with drawRect:. Given that the images are dynamically downloaded from the web, I create an NSOperation and I perform the

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.