I'm using Django and 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. 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)
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
. Of course you will need to activate the virtual environments on both systems before execute the pip
commands.
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.
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.