【问题标题】:Is there a HOWTO to FCGI for deploying Satchmo? [closed]FCGI 是否有用于部署 Satchmo 的 HOWTO? [关闭]
【发布时间】:2012-06-30 21:08:25
【问题描述】:

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 文件后使用了这些文件。我不相信它。我只是没有用谷歌搜索过更好的东西。

有什么建议吗?

【问题讨论】:

    标签: python django deployment fastcgi satchmo


    【解决方案1】:

    我已经成功部署了另一个选项,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 的命令行调用相结合。

    【讨论】:

      猜你喜欢
      • 2011-04-19
      • 1970-01-01
      • 2011-06-16
      • 1970-01-01
      • 2010-11-08
      • 2016-01-31
      • 1970-01-01
      • 1970-01-01
      • 2013-01-31
      相关资源
      最近更新 更多