apache2部署多个django项目

可以通过监听端口的不同来区分两个项目。

!!!!!!下面的这个配置会导致由于进程冲突而造成404错误  !!!正确的方法在下面!!!!!!

# WSGIpythonpath

WSGIPythonPath /path/to/DiningHouse:/path/to/Interface-for-club/ClubServerInterface


# django project 1 服务号的测试虚拟机
<VirtualHost *:8000>
ServerAdmin 9701346703@qq.com
ServerName www.DiningServer.com
Alias /media/ /path/to/DiningHouse/media/
Alias /static/ /path/to/DiningHouse/static/


<Directory /path/to/DiningHouse/static>
Require all granted
</Directory>


<Directory /path/to/DiningHouse/media>
Require all granted
</Directory>


WSGIScriptAlias / /path/to/DiningHouse/DiningHouse/wsgi.py
#WSGIPythonPath /path/to/DiningHouse


<Directory /path/to/DiningHouse/DiningHouse>
<Files wsgi.py>
Require all granted
</Files>
</Directory>

</VirtualHost>







# 服务器2 酒吧接口查看系统
Listen 8088

<VirtualHost *:8088>

...


!!!!!!!!!  需要设置deamonProcess 和processgroup  并在对应的wsgi里设置process-group,才可以保证进程没有混乱。当然也可使用时修改setting的方式,详细信息见django官网文档 http://python.usyiyi.cn/django/howto/deployment/wsgi/modwsgi.html#daemon-mode


# 服务器2 
# 酒吧的进程


Listen 8088
WSGIDaemonProcess ClubServerInterface python-path=/path/to/Interface-for-club/ClubServerInterface
WSGIProcessGroup ClubServerInterface
<VirtualHost *:8088>
ServerAdmin 970135203@qq.com
ServerName localhost:8088
Alias /media/ /path/to/Interface-for-club/media/
Alias /static/ /path/to/Interface-for-club/static/


<Directory /path/to/Interface-for-club/static>
Require all granted
</Directory>


<Directory /path/to/Interface-for-club/media>
Require all granted
</Directory>


WSGIScriptAlias / /path/to/Interface-for-club/ClubServerInterface/ClubServerInterface/wsgi.py process-group=ClubServerInterface
#WSGIPythonPath /path/to/Interface-for-club/ClubServerInterface


<Directory /path/to/Interface-for-club/ClubServerInterface/ClubServerInterface>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值