I have a dev and production instance. Many hooks.py functionalities are not being picked up and executed in the production server, but work fine in the dev instance.
I can confirm this after doing the following in both environments,
bench --site <site-name> console
The output of frappe.get_hooks has only the entries it picks up from the out-of-box frappe and erpnext apps while ignoring the customized app.
( Though on doing bench console, I am shown a message saying Apps in this namespace:
frappe, erpnext, )
What am I missing?
I made the experience, that after install of an app, bench migrate needs to be run.
Thanks for the response @revant_one.
Tried the above, switched on developer mode, and cleared cache. frappe.get_hooks() still doesn’t pick the entries in my custom app hooks.py. ( Although I believe developer mode need not be 1 for hooks to work as expected )
Please let me know if you can think of any other way to see why this is breaking
bench migration has already been done on the instance
Strangely, restarting the AWS instance solved the problem. So marking this as solution
I still don’t understand how it got solved though, what exactly caused this?
Putting this here for posterity.
Clearing redis cache isn’t enough because
hooks.py is loaded as a python module. So,
gunicorn will keep using the older version of
hooks.py, just like it’ll keep using the older version of all other python code until restarted with
bench restart --web