[HCoop-Help] django server

eyecreate at hcoop.net eyecreate at hcoop.net
Thu May 7 14:39:31 EDT 2009


It seems it would be simpler to run a cgi script to run it according to the
django book I was reading. Is it possible to accomplish this?

Running Django on a Shared-Hosting Provider with Apache

Many shared-hosting providers don’t allow you to run your own server daemons
or edit the httpd.conf file. In these cases, it’s still possible to run
Django using Web server-spawned processes.

Note

If you’re using Web server-spawned processes, as explained in this section,
there’s no need for you to start the FastCGI server on your own. Apache will
spawn a number of processes, scaling as it needs to.

In your Web root directory, add this to a file named .htaccess

AddHandler fastcgi-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ mysite.fcgi/$1 [QSA,L]

Then, create a small script that tells Apache how to spawn your FastCGI
program. Create a file, mysite.fcgi, and place it in your Web directory, and
be sure to make it executable

#!/usr/bin/python
import sys, os

# Add a custom Python path.
sys.path.insert(0, "/home/user/python")

# Switch to the directory of your project. (Optional.)

# os.chdir("/home/user/myproject")

# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "myproject.settings"

from django.core.servers.fastcgi import runfastcgi

runfastcgi(method="threaded", daemonize="false")


-----------------------------------------------------------------
http://eyecreate.googlepages.com/quotes




On Thu, May 7, 2009 at 1:43 PM, Benjamin Hell <beni at hcoop.net> wrote:

> Hcoop wrote:
> ^^^^^
> You are using a very generic (and somewhat mis-leading) name for
> your hcoop address setup in Gmail...
>
> > thanks, for your replys. If mod_python is the best option for hcoop, how
> > would I go setting it up to run in the background?
>
> There is detailed information on how I did it on the wiki:
>
> http://wiki.hcoop.net/RunningYourOwnApache
>
> For the Django part I haven't written anything (yet), but if I
> recall right it was pretty a straightforward task with the Django
> documentation, after mod_python was running properly (for testing
> that see the simple example in the mod_python documentation).
>
>
> Cheers,
>
> Beni
>
> _______________________________________________
> HCoop-Help mailing list
> HCoop-Help at lists.hcoop.net
> https://lists.hcoop.net/listinfo/hcoop-help
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.hcoop.net/pipermail/hcoop-help/attachments/20090507/0ff12841/attachment.htm 


More information about the HCoop-Help mailing list