I just tried not sharing folder in my setup (Docker on Windows 10).
When I made change to python file using bash text editor (nano) it automatically detect change !!
07:22:47 web.1 | * Detected change in '/home/frappe/bench/apps/erpnext/erpnext/selling/doctype/customer/customer.py', reloading
07:22:47 web.1 | INFO:werkzeug: * Detected change in '/home/frappe/bench/apps/erpnext/erpnext/selling/doctype/customer/customer.py', reloading
07:22:48 web.1 | * Restarting with inotify reloader
07:22:49 web.1 | * Debugger is active!
07:22:49 web.1 | * Debugger PIN: 923-896-094
So I think the problem might be because shared folder.
@janecek.mato Could you confirm this by not sharing folder and change file through remote host connection or even change file using text editor on server using vagrant ?
If it is problem with shared folder we can narrow the problem and tried to fix this.
Never mind that just tried again with shared folder it still works.
But it won’t works with change made using VSCode.
So could you try making change using bash text editor ?
According to this Flask Auto Reload Is Not Detecting Changes in a VM
I manage to make Frappe detect change from changing.
/apps/frappe/frappe/apps.py
by adding reloader_type='stat',
to run_simple
command
The downside seems to be it used more battery according to Werkzeug manual
def serve(port=8000, profile=False, no_reload=False, no_threading=False, site=None, sites_path='.'):
global application, _site, _sites_path
_site = site
_sites_path = sites_path
from werkzeug.serving import run_simple
if profile:
application = ProfilerMiddleware(application, sort_by=('cumtime', 'calls'))
if not os.environ.get('NO_STATICS'):
application = SharedDataMiddleware(application, {
'/assets': os.path.join(sites_path, 'assets'),
})
application = StaticDataMiddleware(application, {
'/files': os.path.abspath(sites_path)
})
application.debug = True
application.config = {
'SERVER_NAME': 'localhost:8000'
}
in_test_env = os.environ.get('CI')
if in_test_env:
log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)
run_simple('0.0.0.0', int(port), application,
reloader_type='stat',
use_reloader=False if in_test_env else not no_reload,
use_debugger=not in_test_env,
use_evalex=not in_test_env,
threaded=not no_threading)