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?
I've succeeded at deploying it with another option, FCGI:
In sites-enabled:
FastCGIExternalServer /home/jonathan/testfcgi/testfcgi.fcgi -host 127.0.0.1:3033
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName testfcgi.jonathanscorner.com
DocumentRoot /home/jonathan/testfcgi
Alias /media /home/testfcgi/media
RewriteEngine On
RewriteRule ^/(media.*)$ /$1 [QSA,L,PT]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ /testfcgi.fcgi/$1 [QSA,L]
<Directory /home/jonathan/testfcgi/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
This is combined with a command line invocation of fcgi.