0

I am trying to reuse an existing django app, django-reviews. I set it up based on the instructions and the code is now under dist-packages.

>>> import review
>>> review
<module 'review' from '/usr/local/lib/python2.7/dist-packages/review/__init__.pyc'>

The other apps that I am writing are under my project's root directory, which is under version control along with requirements.txt

Problem

Some of the conventions are different between the app's code and my code. For instance,

1) the templates in the app extend {% base.html %} and my base.html is actually named {% "__base.html" %"}. 2) The url structure for signing in for the app is accounts/sign_in, but my current sign_in url is at "/log_in"

Question

Changing the code under dist-packages doesn't seem like a good solution, as it will be outside of my version control and it isn't in my project's home directory either. Changing my code to match the app's logic will be a problem if there is any other conflicting app in the future.

Should I instead use the source code as a reference and create a new app called review in my project's home directory?

What is the recommended approach when dealing with such issues?

Rajesh Chamarthi
  • 18,568
  • 4
  • 40
  • 67

1 Answers1

1

Modifying code in the dist-packages directory is never a good idea. I only do it to debug packages I use, but never for a permanent change.

If you do need to change the source code of a package, you best fork the repository and make your changes. You can add it to your project the way you want it (as Git submodules, or just import it in your existing repository).

However, the idea of a django reusable app is that it's reusable for many purposes and you don't have to fork it to make it usuable for you. Maybe this app isn't configurable enough for you. You can try to contribute to this project to make it more configurable, so it's more accessible to more people. That's of course a little bit more work, but can be fun!

gitaarik
  • 42,736
  • 12
  • 98
  • 105
  • Thanks! Most of the changes are related to coding style, which I don't think need to be configurable. I'll fork the project for now. – Rajesh Chamarthi Dec 24 '14 at 01:59