27.12.2012 5:03, warsam...@gmail.com kirjoitti:
I am having an unbelievable time getting my new django application to
servie static files, i have read the django documentation but it seems
as there isn't one consistent way to serve static files while in
development using the Django server.

In order are my settings.py file, my urls.py file and finally in my
base.html where i reference these files.


I have no idea why i still get 404 not found errors when the path is
full load as in when i reference in my base.html file {{ Media_Url}} it
actually resolves to /media/ yet the file is still not found.

If anyone can help, please let me know. i have spent way to long on this
small issue.

First STATIC_ROOT setting means location where collectstatic collects are your static files using finders. Usually you have two finders used, firstone is FileSystemFinder that uses STATICFILES_DIRS to find static files. Both settings must be absolute path(s).

Note that STATIC_ROOT is not needed for runserver

And second one is AppDirectoriesFinder that finds static files under static/ -folder of your apps (including admin app).

Both are analoguous to template-serving.

MEDIA_ROOT is meant for user uploaded content.

STATIC_URL then gives root URL where static files are served. In testing /static/ is good one, in production you might want to do some optimizations there.

Now you should be able to get it working.

--
Jani Tiainen

- Well planned is half done and a half done has been sufficient before...

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

Reply via email to