Python Changes are not loaded Local Dev Environment Using Vagrant - OSX

You think that i am running it through supervisor? But i run it manually and think that i am running it right way (maybe i am wrong). I am starting bench manually, after every vagrant up or reload.
I am doing it with this command:

bench start

Or maybe you was thought something else?

Yes, I thought that you might be running it with supervisor. Sorry man. Maybe @vjFaLk can help? He’s a pro vagrant user.

1 Like

Hi EVERYONE,
any other suggestions??
Thanks

Start over? Most of the folks I know on OSX are running it locally and Dominik’s tutorial is very good.

Yes, maybe start over is good way. For now, i am running every python change through whitelisted function (in console: bench execute) and it is working without any restart, or clear cache command.

Which one is “Dominik’s tutorial” ?

Thanks.

Tyler likely is referring to these wiki pages -

Dominiks from 2016 Installing Bench Pre requisites on MacOSX · frappe/bench Wiki · GitHub

that seems to be derived from this Turning a Mac into a Developer Machine based on Master branch without Installer

Note that Rushabh’s is current Turning a Mac into a Frappe Framework Developer Machine · frappe/bench Wiki · GitHub

ok thanks, will try this too, i had some problems with installing it on my mac few months ago when i started. So i choosed vagrant box. But now i am little bit more familiar with erpnext, so maybe i will be able run it also without vagrant.

bench migrate should update all the python changes made wouldn’t it?

So have your vagrant site up and running.
Make code changes in atom
switch to terminal
bench migrate

bench migrate will read JSON files and make changes to the database accordingly

Maybe used in conjunction with bench reload-doc
bench --site mysite.name reload-doc MYMODULE MYDOCTYPE MYDOCNAME

Or use one of the update variants listed below

bench update
Pulls changes for bench-repo and all apps, applies patches, builds JS and CSS, and then migrates.
bench update --pull
Pull changes in all the apps in bench
bench update --patch
Run migrations for all sites in the bench
bench update --build
Build JS and CSS artifacts for the bench
bench update --bench
Update bench
bench update --requirements
Update requirements
bench update --restart-supervisor
Restart supervisor processes after update

Did you guys mean in normal development server if I make a change in python file it will immediately reloaded on server without having to run bench stop and bench start ?

THIS IS NEW FOR ME !! :flushed:

Unfortunately, no. This thread references a development environment.

thanks for your answer

i tried bench migrate command, and yes, python changes was loaded after bench migrate. But this is not solution for me. Bench migrate took few minutes. Its too long in developing.

@janecek.mato Can you share your site_config.json file? I’m convinced that you’re not in developer mode.

Sorry, I meant development environment.

Did you guys mean in normal development environment if I make a change in python file it will immediately reloaded on server without having to run stopping bench and run bench start again ?

@tmatteson we was talking about that :slight_smile:

{
"db_name": "1bd3e0294da19198",
"db_password": "tkoAXvsa0SbaJgPa",
"developer_mode": 1,
"encryption_key": "9Y33YeW-WzRs4f70vDAmacVcWPhUH5PHXVaMNZpcmIk=",
"host_name": "http://127.0.0.1:8016",
"limits": {
 "space_usage": {
  "backup_size": 3.0,
  "database_size": 24.38,
  "files_size": 1.0,
  "total": 28.38
 }
}
}

@janecek.mato I know! I don’t know what else it could be. This is exactly that behavior which is why I’m so confused. To be clear it should be in site_config.json, not common_site_config.json

@pipech Yes, when you make changes to python, it works that way, at least on localhost. You can set up remote editing packages with your text editor to make changes to an offsite/cloud server. I know these is available for Atom and VSCode at the very least, it’s usually a combination of mate/rmate and ftp.

@tmatteson

{
 "db_name": "at_local", 
 "db_password": "X0hZFoK0gwme2xBi", 
 "db_type": "mariadb", 
 "developer_mode": 1, 
 "encryption_key": "eXQBTWa4furPQNbBGwgtQCi7xxCBB89RNmqttrP2F9w=", 
 "limits": {
  "space_usage": {
   "backup_size": 4.0, 
   "database_size": 26.44, 
   "files_size": 5.0, 
   "total": 35.44
  }
 }
}

These are basically the same. The DB type shouldn’t be a variable that effects this. You have run bench disable-production, right? I think I suggested that already.

Well, I got exactly same behavior as OP.

I’m using Docker on Windows 10 and have turn on developer mode on site.

Can it be because of share resource ?

In my setup Apps folder and Sites folder has been share from Docker to host OS.

when i run this command, i get error, but it is maybe because of in vagrant is not production setted, like nginx and etc…

 frappe@ubuntu:~/frappe-bench$ sudo bench disable-production
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/frappe/.bench/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/.bench/bench/commands/utils.py", line 152, in disable_production
    disable_production(bench_path='.')
  File "/home/frappe/.bench/bench/config/production_setup.py", line 64, in disable_production
    reload_nginx()
  File "/home/frappe/.bench/bench/config/production_setup.py", line 142, in reload_nginx
    subprocess.check_output(['sudo', find_executable('nginx'), '-t'])
  File "/usr/lib/python2.7/subprocess.py", line 567, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
    raise child_exception
TypeError: execv() arg 2 must contain only strings

Did you share folder from Vagrant to Host?