0

I have django+python+apache2+mod_python installed hosted and working on ubuntu server/ linode VPS. php5 is installed and configured. We don't have a domain name as in example.com. Just IP address. So my apache .conf file looks like this

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

<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. 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

1 Answer 1

1

I need to test it, but this should get your Django project running at /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.

Sign up to request clarification or add additional context in comments.

3 Comments

However I want to host django app on root and not /mysite. If I do that then /vtiger urls are also redirected to django app.
You probably can only achieve what you want with mod_wsgi then, as Apache/mod_wsgi when configured properly can give preference to static resources even when Python web application mounted at root of web site. To do that with mod_python would be much more difficult and/or impossible. If you are happy moving to mod_wsgi, then can give explanation as answer and point you to where in documentation it talks about this sort of setup.
I finally ran both using mod_python but used different ports.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.