Bench install-app is not getting effective

Hi,

I have a custom app that is only for website development (home_page in hooks.py and then www folder contains web pages). After bench install-app, it does not become effective on the site. Whereas it’s properly working in my local environment. I did try to uninstall, install, bench migrate, bench restart, and bench update multiple times. The new website does become effective at all.

To confirm the app installation I checked the custom module is present after logging in to the site.

frappe  13.0.0-beta.10 version-13-beta
erpnext 13.0.0-beta.11 version-13-beta

How do I debug this?

Edit 1:
However, bench --site site1 list-apps does not list my custom app

Any ideas guys ??

@gavindsouza
I had to tag you… In one of my bench environment the hooks is not effective. The custom app hooks are not effective at all. How can I debug this ?

erpnext 13.0.0-beta.13
frappe 13.0.0-beta.11

Bench Version

5.3.0

I have noticed that this happens after site restore. The custom app hooks.py does not become effective.

Steps to reproduce the issue

bench new-site site1.local --install-app erpnext
bench --site site1.local restore <db_file> --with-private-files <private_file_path> --with-public-files <public_file_path>
bench --site site1.local install-app custom_app

@mujeerhashmi After you’ve restored a site on a bench, I’d recommend you run a migrate before anything, to sync the database with the versions of the current apps.

Unsure what the issue you might be facing with install-app. I’m not sure what you mean by “custom app hooks.py does not become effective”. Can you add your reasoning for this statement?

I mean the overrides defined in hooks.py does not take any effect
for ex: home_page = "index"
The new home page does not reflect on the website. similarly overridden white listed methods using
override_whitelisted_methods do not execute etc.

The steps I followed to restore the site

bench new-site site1.local --db-name site1 --install-app erpnext
bench --site site1.local restore <db_file> --with-private-files <private_file_tar> --with-public-files <public_file_tar>
sudo bench setup lets-encrypt site1.local
sudo bench setup production <username>

I will try migrating first as recommended by you. But Should I be setting up the new-site from browser before restore ?

@mujeerhashmi hi, did you solved this problem? i am facing same issue, i created and installed custom app on v13 but its not effecting anything.

Hey guys, @mujeerhashmi & @shahid ,

When you get back up from the old ERP then it contains the sql.gz file you have to provide the sql.gz file path to the restore command…!!

eg. bench restore /home/user/downloads/…your file name pass here…!! and after it will ask you for your SQL MariaDB root password then provide the password and it’ll restore the database over the site that you have been created…!!

hi @Vaibhav_Parmar i haven’t took backup and restored, i just updated to v13 from v12,
then i created new-app.

The app will run correctly? or having some errors?

No errors, its just not executing the code.

doc_events = {
	"User": {
		"validate": "custom_app.custom_work.test_user_validate",
	}
}

even this block is not executing.

def test_user_validate(self, method):
	frappe.msgprint("there")

Well I’m creating custom app under the app_name/app_name/app_name/custom_scripts/here is all files like .py or .js files it’s work fine…!

here is the code…,

In lead.py file =>

from future import unicode_literals
import frappe
from frappe import msgprint
from frappe.model.document import Document

@frappe.whitelist()
def get_details(doc, method):
return frappe.msgprint(“Lead Has Been Saved Successfully…!!”,indicator=“green”)

in hooks.py file =>

doc_events = {
“Lead”:{
“validate”:“dara.dara.custom_scripts.lead.get_details”
}
}

check if this helpful…,

@shahid Can you check without using --db-name option

bro the same code is working on other systems.

@mujeerhashmi i am not using --db-name option anywhere, can you explain more?

The code that I was written is working fine in my system. even if I don’t know the same code as I have written that you said is not working correctly or not effective…!! well check other posts if you found something then tell…,

@mujeerhashmi have raised same issue in this topic, thats why i am trying to get some help from here, however i’ve created separate topic.
@Vaibhav_Parmar thanks for your time bro.

1 Like

created new app and its working. but old one still not working.

Faced this problem too.

Sorted out this problem

  1. bench console
  2. Run
    frappe.cache().get_value('all_apps', frappe.get_all_apps)
  3. Add your app to that list name. e.g. [‘frappe’, ‘erpnext’] should be come [‘frappe’, ‘erpnext’, ‘my_app’]
  4. Run frappe.cache().set_value('all_apps', ['frappe', 'erpnext', 'my_app'])
  5. bench restart; bench clear-cache

Try again. It should work.

Hope it helps you too.

3 Likes