Search code examples
pythondjangodotcloud

Change dependencies code on dotcloud. Django


I'm deploying my Django app with Dotcloud. While developing locally, I had to make changes inside the code of some dependencies (that are in my virtualenv).

So my question is: is there a way to make the same changes on the dependencies (for example django-registration or django_socketio) while deploying on dotcloud?

Thank you for your help.


Solution

  • There are many ways, but not all of them are clean/easy/possible.

    If those dependencies are on github, bitbucket, or a similar code repository, you can:

    • fork the dependency,
    • edit your fork,
    • point to the fork in your requirements.txt file.

    This will allow you to track further changes to those dependencies, and easily merge your own modifications with future versions.

    Otherwise, you can include the (modified) dependencies with your code. It's not very clean and increases the size of your app, but that's fine too.

    Last but not least, you can write a very hackish postinstall script, to locate the .py file to be modified (e.g. import foo ; foopath = foo.__file__), then apply a patch on that file. This would probably cause most sysadmins to cringe in terror, but it's worth mentioning :-)