Install Frappe On Windows 10
Installing and Setting up Frappe Framework with PostgreSQL on WSL Ubuntu-20.04
In this guide, we will walk through the steps to install and set up the Frappe framework with PostgreSQL on Windows Subsystem for Linux (WSL). Frappe is a full-stack web application framework used for rapid development of web applications and ERP systems.
Prerequisites
Before you begin, make sure you have the following prerequisites:
- Windows 10 or later: Ensure that you have a Windows version that supports WSL.
- WSL installed: Set up WSL on your system. You can follow the instructions here.
- Ubuntu WSL distribution: We’ll be using the Ubuntu-20.04 distribution in WSL for the installation. If you haven’t installed it yet, you can get it from the Microsoft Store or follow the instructions here.
Step 1: Update Ubuntu
Open a terminal in Ubuntu WSL and update the package lists to ensure you have the latest package information.
|
|
Step 2: Install Prerequisites
Frappe and Pyenv require some additional packages to be installed. Let’s install them.
|
|
Install Pyenv to set up required python 3.10 version
|
|
You should have an output ending like following, don’t forget to follow the instructions
|
|
After downloading and executing the bash script of the pyenv, we will add some environment variables using the command:
|
|
Restart the Shell
|
|
Ensure Pyenv is successfully installed
|
|
Install python 3.10 with Pyenv
|
|
Configure python 3.10 as the default version
|
|
Install nvm
|
|
Export environment variables
|
|
Install Node 18
|
|
Ensure it is correctly installed
|
|
Install yarn using npm
|
|
Install wkhtmltopdf
|
|
Step 3: Install PostgreSQL
Frappe needs a database to store its data, and we’ll use PostgreSQL for this purpose.
|
|
Ensure PostgresQL is running
|
|
During the installation, PostgreSQL will create a new system user named “postgres.” To access the PostgreSQL prompt, switch to the “postgres” user.
|
|
Now, enter the PostgreSQL prompt by running:
|
|
Within the PostgreSQL prompt, set a password for the default “postgres” user, and remember it !
|
|
Exit the PostgreSQL prompt by typing:
|
|
Switch back to your normal user:
|
|
Step 4: Install Bench
Bench is a command-line utility used to manage Frappe applications. We’ll install it using pip.
|
|
Confirm the bench installation by checking version
|
|
Step 5: Create a Bench
Now, let’s create a new bench (Frappe application workspace).
|
|
This will create a new bench in the “frappe-bench” directory and install the required Frappe version 14.
Step 6: Install Frappe Site
Create a new site for your Frappe application.
Navigate to the bench directory.
|
|
|
|
You will be asked to input the postgres user password. Then an Admin password that will allow you to login to your created site.
This will create a new site with the specified name “test.site”, and by using --set-default
will designate this site as the current one in currentsite.txt
. this name will be used to access your site.
Step 7: Disable firewall (this is needed to allow websocket connections from your browser).
Run the following command to disable the firewall in WSL:
|
|
Then follow these instructions to add the redis socketio_port (default: 9000) to the firewall inbound rules in windows: https://www.windowscentral.com/how-open-port-windows-firewall
Then get the ip address to add it to the hosts in the next step:
|
|
Step 8: Add the site name to hosts.
Add the name of the created site to your hosts file by adding the following two lines:
|
|
This will match the 127.0.0.1 ip and the wsl ip with the test.site domain. So that you can access your site with that domain.
You can use a service that adds automatically the wsl ip address to your hosts. Here is the link to the service repo: https://github.com/shayne/go-wsl2-host
Step 9: Start Frappe
Start the Frappe development server.
|
|
You should now be able to access your Frappe application by navigating to http://test.site:8000
in your web browser. Remember to replace test.site with your site name.
Congratulations! You have successfully installed and set up Frappe framework with PostgreSQL on WSL.
Please note that this guide covers the basic setup for development purposes. In a production environment, additional security measures and configurations may be necessary.
Common Issues
1. 404 Page Not Found Error After Fresh Installation
Unless you didn’t specify --set-default
option while creating the new site, this issue typically occurs when the currentsite.txt
file does not exist yet. reference
- Create this file inside
sites
directory:
|
|
- Insert the name of your site in the created file, e.g
test.site
. - Stop and Start the Server.
2. yarn install
Raises ERROR: [Errno 2] No such file or directory: 'install'
, while bench init
.
This issue typically occurs due to missing or misconfigured dependencies.
- Check Node.js and Yarn Installation:
|
|
- Use the correct node version by set the default version of node to
v18.x.x
:
|
|