简体   繁体   中英

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 .

I had never used version control but now I am starting to use 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?

Do I change the Nginx config file to point somewhere different?

I just updated the dev branch of my project, and of course the site does not reflect the changes.

How can I tell the server to serve the dev branch or the master branch of the project?

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.

Right now, the Nginx config and the uWSGI config point to a folder like:

/var/www/sitefiles

That is the Django folder (inside it is sitefiles/settings.py etc.).

It is in that folder that I did git init, some commits, branching & pushes.

Does using Git mean that the Nginx and uWSGI config's should point elsewhere?

Its pretty simple goto the path of the project where git is installed and checkout to required banch and touch the wsgi file

git checkout dev
touch project/wsgi.py

or to roll back to master branch

git checkout master
touch project/wsgi.py

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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