Re: How to serve staticfiles with full URL for local development?
On 05-05-12 15:34, e.generalov wrote:
> There was a snippet to display a content of response in browser during
> debugginghttp://miniblog.glezos.com/post/3388080372/tests-browser .
>
> "One of the first issues you might face is seeing a style-less page.
> 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 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.contrib.staticfiles.templatetags.staticfiles.django.contrib.staticfiles.urls.staticfiles_urlpatterns
applies. You have to add that to your urls.py. But normally, you don't
have to.
Reinout
--
Reinout van Rees http://reinout.vanrees.org/
reinout@vanrees.org http://www.nelen-schuurmans.nl/
"If you're not sure what to do, make something. -- Paul Graham"
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home