Search code examples
pythondjangopython-module

get the modules locally for django project


Is there a way to import all the modules in the django project itself instead of setting up again and again in all the systems. I would have used gem freeze or something like that in a rails project.


Solution

  • First of all you should be using virtualenv. This way the python path of your django app only has stuff relevant to it. This also allows you to run several separate django / python apps on the same server without them bumping heads.

    When you have a virtualenv with your django app running in it you need to generate a requirements file.

    pip freeze -E virtualenv_path > stable-req.txt

    You can then use this file to generate a bundle.

    pip bundle mybundle.bundle -r stable-req.txt

    This bundle can then be used to deploy with.