Thanks for taking the time to answer this, much appreciated.

On Oct 22, 6:26 pm, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> On Oct 23, 6:27 am, Scott SA <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I have a django instance running under mod-python/apache and am having 
> > trouble with a user that has a poor-quality connection. The task is to 
> > generate a tab-delim report (rather lengthy one) of which we've been 
> > writing-to-response:
>
> >     "return HttpResponse(report_tdf, mimetype='text/tab-separated-values')"
>
> > Problem is, sometime during the 3-5 minutes it takes to generate this file, 
> > their connection fails. I could send the report via smtp, but would rather 
> > see if I can mark it to disk and then give them a URL to downlod via (esp. 
> > if their connection fails).
>
> > I've tried the standard file I/O mechanisms but, not surprisingly, appear 
> > to be running into a permissions problem. Making the directory 
> > world-writable or adding appache to the django-user's group is not a 
> > particularly appealing idea =8(@)
>
> > Django can upload and mark files to disk but using _that_ mechanism would 
> > appear to be a hack. And while I might be/appear-to-be one, I would prefer 
> > to do things as correctly as possible.
>
> > Soo, does anyone have a suggestion as to where I should head to resolve 
> > this problem?
>
> Use mod_wsgi instead and use its 'daemon' mode to run Django in a
> separate process, configuring that process to run as the user you
> would ideally prefer Django to run as and which would have access to
> the directories you want to write to. For example use the following
> configuration but replace 'user-1' with the actual UNIX user that
> Django instance should run as:
>
>   WSGIDaemonProcess site-1 user=user-1 group=user-1 threads=25
>   WSGIProcessGroup site-1
>
>   Alias /media/ /usr/local/django/mysite/media/
>
>   <Directory /usr/local/django/mysite/media>
>   Order deny,allow
>   Allow from all
>   </Directory>
>
>   WSGIScriptAlias / /usr/local/django/mysite/apache/django.wsgi
>
>   <Directory /usr/local/django/mysite/apache>
>   Order deny,allow
>   Allow from all
>   </Directory>
>
> Alternatively, use a fastcgi solution which allows you similarly to
> run Django in a separate process and using suexec or other means
> enable the Django instance to run as a different user.
>
> Having Django run as a distinct user is the safest way of doing it and
> also means that other user code running in Apache, eg PHP pages, can't
> fiddle with your Django data. To do this though, you will not be able
> to use mod_python since your code runs in the context of the Apache
> child processes. Similary, you can use 'embedded' mode of mod_wsgi,
> but as explained you can use 'daemon' mode of mod_wsgi.
>
> For more information see:
>
>  http://www.modwsgi.org
>  http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to