Python – How to effectively change a 3rd-party Django application?

How to effectively change a 3rd-party Django application?… here is a solution to the problem.

How to effectively change a 3rd-party Django application?

I’m working on a Django application that uses django-leaflet, but this problem applies to any python library. I’d like to change some of the django-leaflet code to see if those changes solve the problem we’re having. What are my options? Do I need to create a sample application in the django-leaflet repository and execute my modified test loop there? Or do I need to upload a separately renamed version of django-leaflet to pypi?

Solution

You can modify your 3rd-party application by uninstalling it using pip uninstall and then copy (or git clone) the application into your source tree. You may need to temporarily add a line of sys.path.append("./django-leaflet") to your manage.py file so that the 3rd-party module will be in scope.

Once you’re happy with your changes, you can send them as pull requests to the original author or upload your own version of the app.

Related Problems and Solutions