Need advice on development mode

ive installed erpnext on production and now i wanna switch to it to development mode to edit some stuff so my question is

  1. is this a best practice or should i be creating a new user for development mode so it will be separate
  2. i manually stopped supervisor and nginx and used the command bench start to start the web server but afterwards i cant access the site anymore. on the console it says
    16:29:22 web.1 | Site 192.168.XXX.XXX does not exist 10x on the screen whenever i access my devices ip. my erpnext is located on another local physical device in my closet.

i havent removed nginx.conf and supervisor.conf yet and was just wondering if this was the reason it failed? if so can anyone tell me why that is?

also is there a explanation or guide to better understand the bench command. like what it really does to the system like what it changes and stuffs like that. I wanna also learn to do everything manually as opposed to bench if possible

You can set to developer mode, make the changes you wish, then later revert back to production mode. However you might encounter some trials when updating bench as the changes you make might be lost unless you run git stash.

Try running

bench setup nginx
sudo service nginx reload

to re-generate nginx config.

Isnt nginx only used in production? Why the need to restart?

I dont think that nginx is used for develop mode only, I have an erpnext instance set to developer mode but successfully pointed to a domain. The need isnt to restart it is to reconfigure, something is fiddling with your nginx configs and perhaps this might fix it. Read up on ports and services in ERPNext, might help you better.

Just a note:
Development (as oppose to production) is different to developer_mode.

Development means your bench is not running on nginx/supervisor.
developer_mode (as you can see in site_config.json) means your site is accepting direct change/modification without having cache.


Can you explain further what development and developer mode is? When should i do development as opposed to developer mode

There’s two different issues at stake: (1) how your server runs; and (2) how edits to Frappe/ERPNext are stored.

When setting up Frappe/ERPNext, you choose to use either “development” or “production”. Production uses nginx, supervisor, and redis to manage processes and serve cached pages. Development uses a built-in server based on werkzeug (initiated with a bench start command). As you would expect, production is more performant, and development is easier to update and debug.

Separately, in your site_config.json file, you can choose to have developer_ mode set to 0 or 1. If developer_mode set off (0), you will be limited in the changes you can make to doctypes, reports, pages, etc., but all changes will be stored in the database in a way that will persist across version updates. If developer_mode is set to be on (1), you have a lot more flexibility. You can edit or create new doctypes, reports, etc. with changes that get stored to the files system. This is intended for development purposes, as changes will be erased on the next bench update. To keep them, you’ll have to push them to a code repository, either through a pull request to the main frappe/erpnext repositories or to your own custom app.

1 Like