I'm in a situation where I've got a project that has a large number of Django views across quite a few different apps. The same codebase and database is being used by a large number of clients. There are a few site-specific use-cases that are coming in and this requires quite a bit of custom code to be written.
I'd like to come up with a strategy where we can have the default functionality and then replace django views based on user parameters and so on. Ideally I'd have a central codebase and a project or app per site but due to the current deployment strategy I don't see how this is possible without a massive refactor.
I don't like this idea but it might demonstrate the problem better, basically having some way to dynamically load up another module and replace the those in views.py would do the job. Or something like a function decorator that checked for a replacement for that function and it calls that or calls the default if it can't find it. Dynamic loading could be done with something like this
The problem I have here is the code base is really large and I need to retain the current API of course and maintain as much backwards compatibility as possible.
Basically I'm looking for suggestions for the most pythonic and clear way to do this.