Thursday, May 10, 2012

Re: How to serve staticfiles with full URL for local development?

On 11 май, 01:54, doniyor <doniyor....@googlemail.com> wrote:
> if your problem is how to serve your static files, just create a folder
> with name static in your main app, then put all of your static files and
> and your STATIC_URL is /static/.

Thanks. I found some more ways to get around the restrictions of the
`staticfiles` due development.

I can to execute the `collectstatic` command, to fill STATIC_ROOT, and
serve it with external server (nginx, for example),
or apply monkey patches at StaticFilesHandler to override some
protected methods.

ps: but why these restrictions are needed in the tool, which should
assist in the development?


> Am Samstag, 5. Mai 2012 15:34:47 UTC+2 schrieb e.generalov:
>
>
>
>
>
>
>
>
>
> > There was a snippet to display a content of response in browser during
> > debugging  http://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 found the node at
> >https://docs.djangoproject.com/en/dev/howto/static-files/#serving-sta...
> > :
>
> > "That's because this view is grossly inefficient and probably
> > insecure. This is only intended for local development, and should
> > never be used in production.
>
> > Additionally, when using staticfiles_urlpatterns your STATIC_URL
> > setting can't be empty or a full URL, such ashttp://static.example.com/."
>
> > Is there a way to omit this limitation for local development?
>
> > (reposted from
>
> >http://groups.google.com/group/django-developers/browse_thread/thread...
> > )

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


Real Estate