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

Hi,

i am using vagrant for my dev enviroment. (Create an Erpnext 9.0 Local Dev Environment Using Vagrant · frappe/frappe Wiki · GitHub)

But i have problem with loading my changes in python. I think that .pyc files are not changed when shared folder file is changed.
I tried:

bench clear-cache
bench restart

but it is not enough, i must do:

bench stop
bench start 

again for taking my python changes.

Javascript changes are taken normally. (because of i think that everythink is installed properly)

So my question is where can be problem…did you met similiar problem? I found some threads about similiar problems but without some usefull solution.

Maybe also important note, i am using Pycharm.

Thank you for any response.

Are you in developer mode? Docs

yes, sure, i have setted dev mode (developer_mode": 1,) in site_config.json

If the vagrant environment is running as a service, this kind of behavior. You will want to disable-production and start bench manually.

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