Adam Grant
Adam Grant

Reputation: 13125

Migrating dependencies with django relocation

I've been managing a Django site my MacBook while syncing changes (via github) to my webfaction production and staging servers.

I've purchased a new MacBook and would like to start rebuilding my environment. My issue is that the GH versioned files were deeper in the projects--at the same level as manage.py and included settings.py, template files, mvc files, etc. However, they did not include the files and data created by installing django apps and dependencies. For that, I was manually installing them on the prod/staging server immediately after installing them on my MacBook env.

What I'm having a hard time understanding is where these dependencies are located. I'm a victim of PHP development and am used to all my files being right there in the public folder.

Now that I have my github repo pulled down, I assume there's a way to copy all this stuff over? I don't think I can remember alllllll of the many dependencies I installed from the very beginning.

Upvotes: 0

Views: 56

Answers (1)

Calvin Cheng
Calvin Cheng

Reputation: 36554

The typical way of managing dependencies for specific projects is to use pip, virtualenv and write/store all the dependencies you have installed for that particular project's virtualenv by running

pip freeze > requirements.txt

in your project's (root) directory and then committing the requirements.txt file into your project git repository.

You can later on reinstall all these dependencies by simply issuing:-

pip install -r requirements.txt

Failing which at this point in time, you will have to manually trying to figure out which dependencies are missing when you try to run your python project and manually pip install each one until your project works.

If you still have your old macbook (probably still do), you can create your requirements.txt file right now by running pip freeze > requirements.txt. But if you did not use virtualenv, you are essentially freezing all your dependencies that you have installed in your old macbook system-wide into your requirements.txt file.

Upvotes: 1

Related Questions