首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在同一台服务器上部署不同版本的django应用

在同一台服务器上部署不同版本的django应用
EN

Stack Overflow用户
提问于 2019-09-18 18:49:20
回答 1查看 83关注 0票数 1

我正在使用Apache & mod_wsgi在我的服务器上部署一个django应用程序。我正在使用wsgi的守护程序模式在服务器上运行django应用程序。

现在我的目标是在同一台服务器上拥有两个或更多版本的django应用程序(每个版本都有自己的设置、数据库等)。例如:

https://test-server.com/

https://test-server.com/dev

我已经更新了位于/etc/apache2/sites available的apache配置文件。这是我的配置文件:

代码语言:javascript
复制
<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerAdmin xyz@gmail.com
    ServerName test-server.com
    ServerAlias www.test-server.com
    #DocumentRoot /var/www/html

    Alias /static /var/www/html/Smart_chat_share/smart_chat_share/static  // This should accesible via https://test-server.com/ which is working
    <Directory /var/www/html/Smart_chat_share/smart_chat_share/static>
            Require all granted
    </Directory>

    WSGIDaemonProcess smart_chat_share python-home=/var/www/html/Smart_chat_share/smart_chat_share/virtual_env python-path=/var/www/html/Smart_chat_share/smart_chat_share
    WSGIProcessGroup smart_chat_share
    WSGIScriptAlias / /var/www/html/Smart_chat_share/smart_chat_share/smart_chat_share/wsgi.py process-group=smart_chat_share application-group=%{GLOBAL}

    <Directory /var/www/html/Smart_chat_share/smart_chat_share/smart_chat_share>
            <Files wsgi.py>
                 Require all granted
            </Files>
    </Directory>

    Alias /dev/static /var/www/html/dev/smart_chat_share/static // This should accesible via https://test-server.com/dev which is not working.
    <Directory /var/www/html/dev/smart_chat_share/static>
            Require all granted
    </Directory>

    WSGIDaemonProcess dev python-home=/var/www/html/dev/smart_chat_share/virtual_env python-path=/var/www/html/dev/smart_chat_share
    WSGIProcessGroup dev
    WSGIScriptAlias /dev /var/www/html/dev/smart_chat_share/smart_chat_share/wsgi.py process-group=smart_chat_share application-group=%{GLOBAL}

    <Directory /var/www/html/dev/smart_chat_share/smart_chat_share>
            <Files wsgi.py>
                 Require all granted
            </Files>
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

SSLCertificateFile /etc/letsencrypt/live/scss.identixweb.com/fullchain.pem
SSLCertificateKeyFile 
/etc/letsencrypt/live/scss.identixweb.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

这是工作版本,但https://test-server.com/dev第二个版本我无法访问和测试。当涉及到https://test-server.com/配置时,我经常会迷路。非常感谢您的帮助。非常感谢!

EN

回答 1

Stack Overflow用户

发布于 2019-09-19 13:13:37

如果有人遇到这个问题,这是我的答案。我只是通过重新排序文件中的django应用程序的配置来解决这个问题。确保首先是子目录,然后才是应用程序配置中的根目录。

这个文档很有帮助:- http://blog.dscpl.com.au/2012/10/requests-running-in-wrong-django.html

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57991022

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档