> > This happens becuase the test server isn t really a web server, and
> > you re probably serving static files from something relative such as
> > '/
> > site_media'. The solution is simple: Run a separate Django server and
> > tweak your development-only static URL to something like:
>
> > STATIC_URL = '
http://localhost:8000/site_media/
> > "
>
> > but this doesn't works anymore, because django.contrib.staticfiles
> > doesn't serve static when STATIC_URL contains full URL.
>
> I don't have any problems with static stuff. The solution is probably
> simply to not include any hostname. What I have (on the server and
> locally on my development box):
>
> STATIC_URL = '/static_media/'
In order for static files at the temporary saved page,
become accessible to the browser,
them urls must be a full.
-- /tmp/pageXXXXXXX.html --
<img src="
http://localhost:8080/static/img.png">
(this suggestion has discribed at the sinppet's page).
>
> In case it still doesn't work: you probably use something else than the
> standard runserver. In that case,
https://docs.djangoproject.com/en/1.4/ref/contrib/staticfiles/#django...
> applies. You have to add that to your urls.py. But normally, you don't
> have to.
I see the code at
https://github.com/django/django/blob/master/django/contrib/staticfiles/handlers.py#L31
, and it looks like
the STATIC_URL checking logic is hardcoded to the handler.
When `django.contrib.staticfiles` is added to INSTALLED_APPS, it
overrides the standard `runserver` command and use
specialized WSGIHandler to serve static files. It is not possible to
change any behavior of this handler with standard
django's request handling tools (urls.py, middlewares, views), because
handler works before them all.
>
rein...@vanrees.org http://www.nelen-schuurmans.nl/