It depends how you are running. When using "manage.py runserver" it serves the static files for you, without even needing to collect them IIRC. But when deploying, you have to run "manage.py collectstatic" and Django collects all the files from the other locations for you and puts them in STATIC_ROOT, which you would configure your webserver to serve at STATIC_URL. The docs are pretty clear on this:

https://docs.djangoproject.com/en/1.4/howto/static-files/

Regards
Phil

On 23/04/2012 12:49, gnesher wrote:
But then shouldn't I expect the files to be served from the
STATIC_ROOT as well ?


On Apr 23, 12:38 pm, Philip Mountifield<pmountifi...@formac.net>
wrote:
There is a slight difference:

   * STATIC_ROOT is where you would like the files to be collected to
     when you run "manage.py collectstatic" and should be empty to begin
     with.
   * STATICFILES_DIRS is where the actual files are located and they will
     be automagically servered under the development server.
   * You can also create a folder called "static" in any app and put
     files in there.

Regards
Phil

On 23/04/2012 12:32, gnesher wrote:









Hi,
I'm not sure if this is a bug or am I missing something but I've
created a very simple test environment and placed a single png file
within my static folder.
The file is being served fine when I set :
STATIC_ROOT = ''
STATICFILES_DIRS = (
      '/Users/guynesher/Work/play/quicktest/testproj/static/',
)
however I'm geting a 404 error when I set it like this :
STATIC_ROOT = '/Users/guynesher/Work/play/quicktest/testproj/static/'
STATICFILES_DIRS = (
)
Based on the STATICFILES_DIRS comment (Additional locations of static
files) I expected I will only need to use it if I have multiple static
files directory which doesn't seem to be the case.
What am I missing here?
--

Philip Mountifield
Formac Electronics Ltd
tel  +44 (0) 1225 837333
fax  +44 (0) 1225 430995

pmountifi...@formac.netwww.formac.netwww.telgas.net


--

Philip Mountifield
Formac Electronics Ltd
tel  +44 (0) 1225 837333
fax  +44 (0) 1225 430995

pmountifi...@formac.net
www.formac.net
www.telgas.net

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