Why am I having trouble deploying with FCGI?

19 views
Skip to first unread message

Jonathan Hayward

unread,
Jun 30, 2012, 6:13:05 PM6/30/12
to satchm...@googlegroups.com
<https://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/> details some setup for FCGI, but while it has material for the Apache config file, it omits the FCGI.

How can I create a site.fcgi file for a daemonized fastcgi process that is running on the same server bound to 127.0.0.1, and listening on port 1234?

--EDIT--

I have the following in my httpd.conf:

    FastCGIExternalServer /home/jonathan/store/deploy/store.fcgi -host 127.0.0.1:1234
    
    <VirtualHost *:80>
        ServerName steampunk.stornge.com
        DocumentRoot /home/jonathan/store/
        Alias /media /home/jonathan/store/media
        RewriteEngine On
        RewriteRule ^/(media.*)$ /$1 [QSA,L,PT]
        RewriteCond %(REQUEST_FILENAME} !-f
        RewriteRule ^/(.*)$ /store.fcgi/$1 [QSA,L]
    </VirtualHost>

In /home/jonathan/store/deploy/store.fcgi I have:

    import os
    import sys
    
    from os.path import abspath, dirname, join
    from site import addsitedir
    
    sys.path.insert(0, abspath(join(dirname(__file__), "../")))
    
    from django.conf import settings
    os.environ["DJANGO_SETTINGS_MODULE"] = "store.settings"
    
    from django.core.servers.fastcgi import runfastcgi
    runfastcgi(method="threaded", daemonize="true")

And I also have, running,

    python manage.py runfcgi method=threaded host=127.0.0.1 port=1234

When I pull up http://[hostname], I get:

    Not Found
    
    The requested URL / was not found on this server.
    
    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
    
    Apache/2.2.22 (Ubuntu) Server at [hostname] Port 80

http://[hostname]/media pulls up a populated index.

What could be improved, or might be causing trouble, in this use of FCGI? store.cgi was based on a couple of .fcgi files lying around which I used after not finding model FCGI files for Satchmo in the Django or FCGI docs. I don't trust it that far; I just haven't Googled something better.

Any suggestions?

TIA,
Reply all
Reply to author
Forward
0 new messages