简体   繁体   English

当我在另一个分支上进行开发时,如何在master分支上本地运行Django服务器

[英]How to run Django server locally on master branch while I am developing on the other branch

I'm setting up a Django 2.1 server and I want to run the server because it's servicing to my LAN. 我正在设置Django 2.1服务器,并且想运行该服务器,因为它正在为我的LAN服务。 I want the server to keep running while I'm developing it on the other branch. 我希望服务器在另一个分支上开发时保持运行。

But the server downs when I change the branch; 但是,当我更改分支机构时,服务器将关闭; Actually its branch changes too! 实际上它的分支也改变了!

How to do that? 怎么做?

You shouldn't be developing and running production code from the same location. 您不应该在同一位置开发和运行生产代码。 That's really bad practice. 真是不好的做法。 You can either: 您可以:

  1. Set up a second copy of your repo in another location that production code runs from (it will only ever be set to the master branch). 在生产代码运行所在的另一个位置设置您的仓库的第二个副本(它只会设置到master分支)。
  2. Develop your code on another system. 在另一个系统上开发代码。

I always opt for number 2 above. 我总是选择上面的2。 I develop on my laptop (running everything locally), then deploy that to a Docker-ized Ubuntu system. 我在笔记本电脑上进行开发(在本地运行所有内容),然后将其部署到Docker化的Ubuntu系统中。

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

相关问题 Django / Python-我应该在本地分支上运行makemigrations,还是仅在master上运行? - Django/ Python- should I run makemigrations on a local branch, or only on master? 如何使git与远程主分支同步 - How can I get git in sync with remote master branch 如何在Nginx / uWSGI服务器上访问Django项目的git分支? - How to visit a git branch of Django project on Nginx/uWSGI server? 你如何在非主分支上干净地维护django迁移? - How do you cleanly maintain django migrations on non-master branch? 当服务器正常工作时,如何在 Django 中运行循环? - How do I run a loop in Django while server is working as usual? 本地开发时的Django静态文件-如何提供绝对服务? - Django static files when locally developing - how to serve absolutely? 如何将 GAE 更改为 python3? 因为我正在开发一个 Django 网站。 - How to change the GAE to python3? Since i am developing a Django website. 如何在使用django manage.py runserver进行开发时使用远程静态文件服务器 - How to use a remote static file server while developing with django manage.py runserver 当我尝试使用Django运行服务器时出现TypeError吗? - Getting TypeError when I am trying to run server using Django? 将我的 Django 应用程序上传到服务器时出现错误 - I am getting an error while uploading my Django app to server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM