Frappe Framework

Frappe Framework

Table of Contents

A full stack web framework created using Python.

Low code, open source, web framework in Python and Javascript for the 21st century Frappe Framework

The Frappe Framework is powered by Python, JavaScript and Redis, to name a few technologies and supports MariaDB and PostgreSQL databases. Jinja is used as the templating engine for Web Views and Print formats. Redis is used for caching, maintaing job queues and realtime updates. More on here

They have a great documentation.

#BuildWithHussain is also good.

A great video about Frappe by Hussain.

DocType:

DocType is the base of Frappe, from what I understood:

  • It is like a database schema
  • For an entity you create a doctype
  • Then we define fields that DocType will hold.

Website:

We can build website using Frappe.

Web forms which have type as Doctype that means those forms can take input from any website visitor and store the response.

Installing Frappe Bench

So bench can be installed in two modes:

  1. Production Mode
  2. Developer Mode

Installing Frappe Bench in developer mode from here

The doc is for Debian/Ubuntu and I’m using Fedora!

Let’s see how it goes.

Step 1: Preparing Development environment:

  1. Git
  2. Python
  3. Redis
$ sudo dnf install redis
  1. MariaDB, installation from here
$ sudo dnf install {community-mysql-server|mariadb-server}
$ sudo systemctl enable mariadb
$ sudo systemctl start mariadb
$ sudo mysql_secure_installation

There is Podman installation too, it will be required later.

  1. NVM
  2. Yarn
  3. wkhtmltopdf
  4. Bench CLI
  5. Cronie

Installing Bench:

$ pip3 install frappe-bench

Step 2: Bench init

$ bench init frappe-bench

Errors:


 In file included from src/hiredis.c:1:
      src/hiredis.h:4:10: fatal error: Python.h: No such file or directory
          4 | #include <Python.h>
            |          ^~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

Solution:

$ sudo dnf install python3-devel

Error:

For key character_set_server. Expected value utf8mb4, found value latin1
For key collation_server. Expected value utf8mb4_unicode_ci, found value latin1_swedish_ci

Solution:

Add this

[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

[mysql]
default-character-set = utf8mb4

to /etc/my.cnf file.


Error:

FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/crontab'

Solution:

$  yum info cronie

Still facing the same issue, restarting now.

Restarting didn’t helped.

ERROR: There was a problem while creating frappe-bench
Do you want to rollback these changes? [y/N]: n
Aborted!

I tried

$ cd frappe-bench
$ bench start

The server started but:

Not Found

127.0.0.1 does not exist.

Is showing.

Because I didn’t install ‘cronie’.

Solved!

Error:

Visiting URL 127.0.0.1:8000 gives Not found error.

The Hitchhiker’s Guide to Installing Frappe on Linux

Solution:

Create new site:

$ bench new-site bawas.hotel

bawas.hotel is site name, you can have any name you want.

Then it will ask for passwords:


Set Administrator password: 
Re-enter Administrator password: 
Updating Dashboard for frappe
bawas.hotel: SystemSettings.enable_scheduler is UNSET
*** Scheduler is disabled ***

After setting the password

Add the site link to hosts file too

$ bench --site bawas.hotel add-to-hosts

TODO:

Right now this is little shaddy for me. I’ll update this section.

Now, I can seee login page at 127.0.0.1:8000

Step 3: Login

By default Frappe app is install on every site. Login using:

  • Username: Administrator
  • Password: that_you_set_while_creating_the_site

Creating user:

Complete Setup!!

Now you can start playing with Frappe!