最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - Configuration of Django+WSGI+Apache - Stack Overflow

programmeradmin0浏览0评论

I have a Debian 11 system with Apache2 2.4.6.2, mod_wsgi 4.7.1 and Python 3.9. I want to run two different Django projects under the same Apache2 server, and in the same virtual host as outlined e.g. here:

.html

The following additions in the apache2.conf have worked fine to get one Django project online:

WSGIApplicationGroup %{GLOBAL}
WSGIDaemonProcess myapp python-home=/var/www/myproj/venv3/ python-path=/var/www/myproj/myproj
WSGIProcessGroup myapp
WSGIScriptAlias / /var/www/myproj/myproj/wsgi.py

To configure the second Django, I first tried to move the configuration of the first project to a virtual host section. However, if I move the configurations to a virtual host in available-sites (e.g. in 000-default.conf), I do not get any error message (e.g. in the apache error log), but instead of my Django project, I see the default apache2 landing page ("It works!"), even if I comment out DocumentRoot. Am I missing something?

I have a Debian 11 system with Apache2 2.4.6.2, mod_wsgi 4.7.1 and Python 3.9. I want to run two different Django projects under the same Apache2 server, and in the same virtual host as outlined e.g. here:

http://www.tobiashinz.com/2019/04/10/apache-django-virtualenv.html

The following additions in the apache2.conf have worked fine to get one Django project online:

WSGIApplicationGroup %{GLOBAL}
WSGIDaemonProcess myapp python-home=/var/www/myproj/venv3/ python-path=/var/www/myproj/myproj
WSGIProcessGroup myapp
WSGIScriptAlias / /var/www/myproj/myproj/wsgi.py

To configure the second Django, I first tried to move the configuration of the first project to a virtual host section. However, if I move the configurations to a virtual host in available-sites (e.g. in 000-default.conf), I do not get any error message (e.g. in the apache error log), but instead of my Django project, I see the default apache2 landing page ("It works!"), even if I comment out DocumentRoot. Am I missing something?

Share Improve this question asked Feb 6 at 11:07 rugerminirugermini 1151 silver badge10 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I fixed it after trying to reproduce it in a new VM. The problem was that I put the WSGI config bits into the VirtualHost for port 80. It contains a Rewrite to forward everything to an SSL-secured connection. Thus, I needed to put the WSGI parameters into the VirtualHost at port 443.

发布评论

评论列表(0)

  1. 暂无评论