Answer the question
In order to leave comments, you need to log in
How to override a module method in Django?
There is a Django application, the package is installed django-photologue
and traditionally included in INSTALLED_APPS
. There was a need to rewrite one of the methods in this module in the lib/python3.4/site-packages/photologue/views.py
. How to do it correctly without affecting the files in site-packages
?
Answer the question
In order to leave comments, you need to log in
There's not a lot of code, so it's easier to override the behavior right next to your views.
I usually add some directory to sys.path in django settings file:
# settings.py
BASE_DIR = path.abspath(path.join(path.dirname(__file__), '..'))
sys.path.insert(1, path.join(BASE_DIR, 'apps_third_party'))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question