简体   繁体   English

当我将Django应用程序从一个系统复制到另一个系统时,如何确定要安装哪些依赖项?

[英]How do I figure out what dependencies to install when I copy my Django app from one system to another?

I'm using Django and Python 3.7. 我正在使用Django和Python 3.7。 I want to write a script to help me easily migrate my application from my local machien (a Mac High Sierra) to a CentOS Linux instance. 我想编写一个脚本来帮助我轻松地将应用程序从本地机器(Mac High Sierra)迁移到CentOS Linux实例。 I'm using a virtual environment in both places. 我在两个地方都使用虚拟环境。 There are many things that need to be done here, but to keep the question specific, how do I determine on my remote machine (where I'm deploying my project to), what dependencies are lacking? 这里有很多事情需要做,但是要保持特定的问题,如何确定我的远程机器(将项目部署到的地方)上缺少什么依赖项? I'm using rsync to copy the files (minus the virtual environment) 我正在使用rsync复制文件(减去虚拟环境)

On the source system execute pip freeze > requirements.txt , then copy the requiremnts.txt to the target system and then on the target system install all the dependencies with pip install -r requirements.txt . 在源系统上,执行pip freeze > requirements.txt ,然后将requiremnts.txt复制到目标系统,然后在目标系统上使用pip install -r requirements.txt安装所有依赖项。 Of course you will need to activate the virtual environments on both systems before execute the pip commands. 当然,在执行pip命令之前,您将需要在两个系统上都激活虚拟环境。

If you are using a source code management system like git it is a good idea to keep the requirements.txt up to date in your source code repository. 如果您使用的是git之类的源代码管理系统,则最好在您的源代码存储库中保持requirements.txt为最新。

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

相关问题 如何确定我的 Django 应用程序需要什么 AWS RDS 实例? - How do I figure out what AWS RDS instance does my Django application need? Django应用-在virtualenv与系统范围内应安装什么? - Django app - What do I install in virtualenv vs system wide? 在Django中,当我不知道在哪里设置跟踪时,如何触发pdb找出导致404错误的原因? - In Django, how do I trigger pdb to figure out what's causing a 404 when I don't know where to set a trace? Django-如何确定django正在记录哪个模块? - Django - How do I figure out what module is being logged by django? 我不知道如何从Django视图中引用我的模板 - I can't figure out how to refer to my template from a Django view 如何将依赖项从一个应用程序注入到另一个应用程序的 Django 类中? - How can dependencies be injected into Django classes from one app into another? 在Django中,如何从另一个模板中引用一个模板? - In Django, how do I reference one template from another one? 当我的应用位于另一个目录中时,如何使用Django South? - How do I use Django South when my app is inside another directory? 如何安装Mezzanine作为Django应用程序? - How do I install Mezzanine as a Django app? 如何在 Django 应用程序中从一个域重定向到另一个域? - How can i redirect from one domain to another in django app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM