英文:
Should I Dockerize my Django app or just make a virtual env?
问题
我使用Django开发了一款会被仅限在客户计算机的本地服务器上使用的会计软件。我的问题是:我应该如何在客户计算机上设置依赖项?是逐个安装所有依赖项吗?还是将我的项目放入虚拟环境并将虚拟环境移到客户的计算机上?或者应该将应用程序放入Docker容器中?
英文:
I developed an accounting software with django which will be only used on the local server of client's computer. My question is: How do I setup the dependencies on clients computer? Do I install all dependencies individually? Or put my project onto a virtual env and move the virtual env into the clients PC? Or should I dockerize the app?
答案1
得分: 2
这完全取决于您项目的复杂性。Docker可能是最佳选择,但如果您的项目依赖性有限,那么虚拟环境就足够了。
英文:
It totally depends on the complexity of your project. Docker could be the best option, but if you have limited dependencies in your project, then virtual environment is enough.
答案2
得分: 1
从你需要的开始。
> 客户计算机的本地服务器
创建一个Python虚拟环境并在其中安装依赖项。确保创建并将requirements.txt
添加到项目的源代码控制中。
pip install -r requirements.txt
您可能希望创建一个服务或systemd单元文件,以在系统启动时自动启动服务器。
英文:
Start with what you need.
> local server of client's computer
Create a python virtual env and install dependencies there. Ensure that a requirements.txt
is created and added to source control on the project.
pip install -r requirements.txt
You may want to create a service or systemd unit file to automatically start the server when the system starts up.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论