代码之家  ›  专栏  ›  技术社区  ›  Ankur Gupta

如何将jjango应用程序与php5在Apache2上与mod_python共同托管?

  •  0
  • Ankur Gupta  · 技术社区  · 16 年前

    我已经安装了django+python+apache2+mod_python,并在ubuntu服务器/linode vps上工作。安装并配置了php5。我们没有example.com中的域名。只有IP地址。所以我的apache.conf文件看起来像这样

    serveradin网站管理员@localhost 文档根/var/www

        <Location "/">
                SetHandler python-program
                PythonHandler django.core.handlers.modpython
                SetEnv DJANGO_SETTINGS_MODULE mysite.settings
                PythonOption django.root /mysite
                PythonPath "['/var/www/djangoprojects',] + sys.path"
                PythonDebug On
        </Location>
    

    我想安装vtiger,所以如果我像这样更改.conf文件

    <VirtualHost *:80>
        DocumentRoot /var/www/vtigercrm/
        ErrorLog /var/log/apache2/vtiger.error_log
        CustomLog /var/log/apache2/vtiger.access_log combined
        <Directory /var/www/vtigercrm>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
        </Directory>
    

    这样,vtiger基于PHP的应用程序工作正常,当然django应用程序不可访问。如何使两者在一个文件中共存?我不能使用虚拟主机/子域。我可以用一个不同的端口,不,你。

    有什么线索吗?

    当做 安古尔古普塔

    1 回复  |  直到 16 年前
        1
  •  1
  •   ken Djangonaut    16 年前

    我需要测试它,但这将使您的django项目在/mysite/上运行:

    <VirtualHost *:80>
        DocumentRoot /var/www/vtigercrm/
        ErrorLog /var/log/apache2/vtiger.error_log
        CustomLog /var/log/apache2/vtiger.access_log combined
        <Directory /var/www/vtigercrm>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
        </Directory>
        <Location "/mysite/">
            SetHandler python-program
            PythonHandler django.core.handlers.modpython
            SetEnv DJANGO_SETTINGS_MODULE mysite.settings
            PythonOption django.root /mysite
            PythonPath "['/var/www/djangoprojects',] + sys.path"
            PythonDebug On
        </Location>
    </VirtualHost>
    

    此外, preferred way to host Django apps is with mod_wsgi .

    推荐文章