Some Questions regarding Frappe Development

Hi, I hope I don’t take much time. I’ve started working with frappe recently. I have a few confusions regarding the lifecycle (or devops?) of frappe development.

This is my understanding so far, kindly correct me where I’m wrong:

i) Frappe has two different environments one for Development, and the other for Production.
ii) Development Environment uses Werkzeug Server. Development mode lets you change source code by turning the flag developer_mode = 1. Now in your custom app, if you create a doctype it will generate the respective python code which you can later modify.
iii) Production Environment uses Nginx Server, Redis, etc.

Now I have a few (dumb) questions:

  1. If you setup both development and production environments on the same machine, how do you transfer your code & schema changes to the production environment? I want to grasp the entire lifecycle of development to production.
  2. Can you change source code in Production Environment?
  3. Is it possible to setup each environment on a different machine?


1 Like

Best is to use GitHub to maintain your code repository and install your custom app on the production environment from there.

Another option is to set up CI/CD pipeline but you will have to use docker based ERPNext installation for this.

1 Like

Those are great questions.

  1. If I was doing this, I’d do something like this:
  • Write my changes in my machine’s development environment/directory.
  • Use git to push those changes to my remote GitHub 'development' branch.
  • When my changes are tested and approved, use git to merge those commits from my 'development' branch into my 'production' branch.
  • Finally, use git to pull the remote GitHub 'production' branch down to my machine’s production environment/directory.

  1. Yes, you definitely can change source code in a Production Environment. The Python, JavaScript, and other files are not read-only or otherwise “locked.” You can edit them at any time…

…which may not be a good idea! :slight_smile: However, nothing will prevent you from doing this.

  1. Yes, it is very normal to have different machines with different environments. For example, today I am working on a system with 4 different environments:
    • Development : My laptop.
    • Test : VPS hosted by Digital Ocean.
    • Staging : A second, different VPS hosted by Digital Ocean.
    • Production: A third, different VPS hosted by Digital Ocean.

The code is synchronized and managed using git and related tools. Data is synchronized and managed using tools like rsync and mysqldump.

Whenever Frappe/ERPNext feels complicated, try to remember that it’s basically just this:

  1. A directory containing thousands of files and subdirectories. Most of them Python, JavaScript, and JSON.
  2. Four databases (which are also just a set of files. but stored somewhere else on the disk)

On a single machine, you can run 1 ERPNext or 10 ERPNexts.

Likewise, it’s possible to take 1 ERPNext, and store its code files on machine A, and databases on machines B, C, D, and E.


Well technically, there are options to prevent Python source code from being changed in production, although they require some manual intervention in lieu of certain bench commands:

  • install app packages with pip in non-editable mode (you can still change the files, but they won’t affect the installation)
  • install pre-compiled bytecode
1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.