简体   繁体   English

如何使用mod_python在apache2上用php5共同托管django应用程序?

[英]How to co host django app with php5 on apache2 with mod_python?

I have django+python+apache2+mod_python installed hosted and working on ubuntu server/ linode VPS. 我安装了django + python + apache2 + mod_python托管并在ubuntu服务器/ linode VPS上工作。 php5 is installed and configured. php5已安装并配置。 We don't have a domain name as in example.com. 我们没有example.com中的域名。 Just IP address. 只是IP地址。 So my apache .conf file looks like this 所以我的apache .conf文件看起来像这样

ServerAdmin webmaster@localhost DocumentRoot /var/www ServerAdmin webmaster @ localhost DocumentRoot / 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>

I want to install vtiger so if I change my .conf file like say this 我想安装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>

This way vtiger the php based app works fine and ofcourse django app is not accessible. 这样,基于PHP的应用程序vtiger可以正常工作,并且django应用程序当然不可访问。 How do I make both co-exist in one file. 我如何使两者共存于一个文件中。 i cannot use virtual host/subdomains. 我无法使用虚拟主机/子域。 I can do with a diff port no thou. 我不能使用差异端口。

Any clue guys ? 有什么线索吗?

Regards Ankur Gupta 问候安库尔·古普塔

I need to test it, but this should get your Django project running at /mysite/: 我需要对其进行测试,但这将使您的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>

Also, the preferred way to host Django apps is with mod_wsgi . 另外, 托管Django应用程序首选方法是使用mod_wsgi

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM