Search code examples
pythondjangoapache2virtualhostdjango-wsgi

Run django in https://example.org/directory - python and php


I have a website https://example.org (HTTPS) with php, Apache2 . I need to run on the same server (Centos 6) a Django app.

It is possible execute django app in https://example.org/my_django_app/?

I can execute in a subdomain (http://my_django_app.example.org/), The problem here is that I need to buy another certificate for the subdomain.

Answer

In Virtualhost configuration (Apache 2.2 ), change the normal configuration

WSGIScriptAlias / /my/route/wsgi.py

Specify the directory name.

WSGIScriptAlias /directory /my/route/wsgi.py

Your Django project run in https://example.org/directory and your https://example.org execute php


Solution

  • Edit virtualhost configuration, and add the configuration for python

    WSGIDaemonProcess inti python-path=/path/to/myproject:/path/to/env/lib/python2.7/site-packages
    WSGIProcessGroup inti
    WSGIScriptAlias /directory /path/to/wsgi.py