How I update code in website production?

Dear, I have the question:

  1. Can I edit .py in production? ( Ex: Edit “Generate Item Code Based On Custom Logic” or “Formatter For Link Fields” ) Or I need to switch to develop mode before editing anything?

  2. I have setup ERPNext with “sudo python install.py --production --user frappe”, I tried edit Hook.py at "frappe-bench/apps/erpnext/erpnext"and remove .pyc, bench -build & restart & clear-cache v.v. but code is not update ( Ex: app_include_js = “assets/js/hide_help_menu.js” ) How can I insert code to hook?

Thank for your help!

@nguyenrom You need to migrate your code as well bench migrate --site sitename

Hi @srajelli, Does that mean:
Step 1: I need to update code to hook.py (Ex: app_include_js = “assets/js/hide_help_menu.js”) at frappe-bench/apps/erpnext/erpnext.
Step 2: Command: bench migrate --site site1.local

@nguyenrom
Step 1. Edit your code
Step 2. bench migrate --site sitename
Step 3. bench clear-cache
Step 4. bench build
Step 5. Clear your browser cache using Reload option from erpnext

1 Like

Thanks @srajelli so much, the tips are great for me!