简体   繁体   English

如何在Nginx / uWSGI服务器上访问Django项目的git分支?

[英]How to visit a git branch of Django project on Nginx/uWSGI server?

I have successfully built several web sites hosted on an Nginx server using Django , uWSG I and virtualenv . 我已经使用DjangouWSG I和virtualenv成功构建了在Nginx服务器上托管的多个网站。

I had never used version control but now I am starting to use Git . 我从未使用版本控制,但现在我开始使用Git

I understand how to create, commit and push branches. 我理解如何创建,提交和推送分支。

My question is: how to make different Git branches visible at the web address of the site I'm working on? 我的问题是: 如何在我正在工作的网站的网址上看到不同的Git分支?

Do I change the Nginx config file to point somewhere different? 我是否将Nginx配置文件更改为指向不同的位置?

I just updated the dev branch of my project, and of course the site does not reflect the changes. 我刚刚更新了我的项目的dev分支,当然该站点没有反映出这些变化。

How can I tell the server to serve the dev branch or the master branch of the project? 如何告诉服务器为项目的dev分支或主分支服务?

I would prefer to avoid a complicated system with different subdomains for different branches — I really just want the simplest thing that will work. 我宁愿避免使用具有不同子域的复杂系统用于不同的分支 - 我真的只想要最简单的工作。

[update] I have found lots of pages that explain complex ways to set up staging servers etc., but I really just want to understand what is going on... there's a giant conceptual hole in my understanding about how the server interacts with a local Git project. [更新]我发现很多页面都解释了设置登台服务器的复杂方法等等,但我真的只是想了解发生了什么......我对于服务器如何与a进行交互的理解存在巨大的概念漏洞本地Git项目。

Right now, the Nginx config and the uWSGI config point to a folder like: 现在,Nginx配置和uWSGI配置指向如下文件夹:

/var/www/sitefiles

That is the Django folder (inside it is sitefiles/settings.py etc.). 那是Django文件夹(里面是sitefiles / settings.py等)。

It is in that folder that I did git init, some commits, branching & pushes. 它在那个文件夹中我做了git init,一些提交,分支和推送。

Does using Git mean that the Nginx and uWSGI config's should point elsewhere? 使用Git是否意味着Nginx和uWSGI配置应指向别处?

Its pretty simple goto the path of the project where git is installed and checkout to required banch and touch the wsgi file 它很简单,转到安装了git的项目的路径,并检查所需的banch并触摸wsgi文件

git checkout dev
touch project/wsgi.py

or to roll back to master branch 或回滚到主分支

git checkout master
touch project/wsgi.py

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM