是否有一个HOWTO到FCGI部署Satchmo?

时间:2012-06-30 21:08:25

标签: python django deployment fastcgi satchmo

https://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/详细介绍了FCGI的一些设置,但是虽然它有Apache配置文件的材料,但它省略了FCGI。

如何为绑定到127.0.0.1的同一台服务器上运行并在端口1234上侦听的守护进程fastcgi进程创建site.fcgi文件?

- 编辑 -

我的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>

在/home/jonathan/store/deploy/store.fcgi我有:

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")

我也有,跑步,

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

当我拉出http:// [hostname]时,我得到:

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拉出一个填充的索引。

在使用FCGI时,有什么可以改进或可能造成麻烦? store.cgi基于几个.fcgi文件,我在Django或FCGI文档中找不到Satchmo的模型FCGI文件之后使用了这些文件。我不相信它那么远;我只是没有用Google搜索更好的内容。

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

我已成功部署了另一个选项FCGI:

在已启用网站中:

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>

这与fcgi的命令行调用相结合。