Re: Feature request: serve_file() view in static app

2014-01-19 Thread German Larrain
PyPI packages 'static' and 'dj-static' might help you. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To

Re: Feature request: serve_file() view in static app

2014-01-15 Thread Andre Terra
Use nginx? http://nginx.org/en/ Cheers, AT On Tue, Jan 14, 2014 at 6:18 PM, Rivo Laks wrote: > Hm, indeed. > > Is there any better alternative or best practice for my usecase though? > Basically I want a view that responds with contents of a static file and >

Re: Feature request: serve_file() view in static app

2014-01-14 Thread Apostolos Bessas
Hi Rivo, So, if I understand this correctly, you need Django to figure out, whether you need to serve the static HTML page or not. In this case, you could use http://wiki.nginx.org/X-accel; that is, return a HttpResponse with the X-Accel-Redirect header pointing to the static file. I suppose

Re: Feature request: serve_file() view in static app

2014-01-14 Thread Rivo Laks
X-accel looks promising, I'll see if it can solve my problem. Thanks! Rivo teisipäev, 14. jaanuar 2014 23:58.13 UTC+2 kirjutas Marc Tamlyn: > > If you're on nginx, There are also some cases where you may find > X-ACCEL-REDIRECT useful, which allows you to return a blank HTTPResponse > from

Re: Feature request: serve_file() view in static app

2014-01-14 Thread Marc Tamlyn
If you're on nginx, There are also some cases where you may find X-ACCEL-REDIRECT useful, which allows you to return a blank HTTPResponse from Django and tell nginx to serve a file. Nginx Docs: http://wiki.nginx.org/X-accel Blog post:

Re: Feature request: serve_file() view in static app

2014-01-14 Thread Rivo Laks
Nono, I need Django for the API and backend logic :-) Let me illustrate my needs a bit better: - I have Django instance that serves API and a few related services and handles backend logic. - I also have nginx server in front of the Django instance, that also serves static files (css/js, which

Re: Feature request: serve_file() view in static app

2014-01-14 Thread Aymeric Augustin
You don’t need an application server running Django to serve a file. A plain and simple web server such as Apache or nginx will do. It’s a good practice to put application servers behind a web server acting as a reverse proxy (and possibly load balancer), so you probably have one already. It’s

Re: Feature request: serve_file() view in static app

2014-01-14 Thread Rivo Laks
Hm, indeed. Is there any better alternative or best practice for my usecase though? Basically I want a view that responds with contents of a static file and django.views.static.serve() does pretty much exactly that. Or is my usecase just too fringe to be handled by Django core? Rivo

Re: Feature request: serve_file() view in static app

2014-01-13 Thread Marc Tamlyn
`django.views.static.serve` is, in the words of the documentation, grossly inefficient and probably insecure, so it is unsuitable for production. Any attempt to make it more useful than its current use case (serving staticfiles in development) is unlikely to happen. Marc On 13 January 2014

Feature request: serve_file() view in static app

2014-01-13 Thread Rivo Laks
Hi everyone, I'm proposing to split out from the django.views.static.serve() view the functionality to serve a single static file. The new view could be named serve_file(), would take request and fullpath as parameters and would serve the given file. The code would essentially be the second