Flask-based implementation of gitbook-like projects: beibq


Project source: https://github.com/chaijunit/…

Beibq is an open source book blog based on flask.

Because many blog systems are mainly in the form of articles; if more articles are recorded, they need to be categorized, and it will be more difficult to find a previous article.

Bebq is a way to write a blog by writing books, because books themselves have the function of classification, even if the contents of the records become more, it is not confused, and when reading, it is convenient to switch to other chapters by clicking on the book catalogue.

Installation configuration

Flask-based implementation of gitbook-like projects: beibq

After the website is built, the configuration interface will appear when the browser is used to access it.

Writing books online

Flask-based implementation of gitbook-like projects: beibq

Bebq’s editor supports Markdown. Markdown is a markup language that requires only a few simple markup symbols to transform into rich HTML formats, especially for blogging. Specific Introduction to Markdown: Markdown Grammar Description

Bebq’s editor interface is simple and easy to operate. It can input Markdown markers through toolbars or shortcuts to improve writing efficiency. The editor’s catalog area supports dragging chapters and can adjust the order of chapters.

Editor example: online book writing

Bebq’s editor is a pure JS implementation, and I’ll open it up separately: bookeditor

When you have written a book and click on it to publish it, you can see the latest book trends on the home page.

Flask-based implementation of gitbook-like projects: beibq


The interface of beibq is simple, beautiful and easy to use. When reading a blog, like reading a book, the interface contains a Book catalog, so that you can easily switch to other chapters by clicking on one chapter of the catalog.

Flask-based implementation of gitbook-like projects: beibq

In order to improve the efficiency of switching chapters, when clicking on a chapter in the catalog and asynchronously requesting chapter content through ajax, it can not only improve the page refresh speed, but also have a good reading experience.

In fact, using Ajax asynchronous request chapters will cause a problem, when the network delay is high, users click on multiple chapters in a short time, which will lead to confusion in page display. To solve this problem, I designed a queue to cache the event when users click on chapters into the queue, if they receive multiple click events in a short time. I actually only request the last event in the queue.

Bebq also automatically adapts the mobile interface, allowing users to read on mobile devices.

Installation and use

1. Install MySQL

Bebq uses mysql, which needs to be installed before installation.

I’m using centos, and the installation method can refer to this document: Installing MySQL on Linux Using the MySQL Yum Repository

2. Installing dependency packages

pip install -r requirements.txt

3. Start the program

python manage.py runserver -h

4. Configuring Sites

Enter in the browser

The first visit will jump to the configuration interface, and you can use beibq after configuring site information according to instructions

Recommended Today

Common web tools

Necessary Java tool class and Middleware <!– Maps,Sets,CollectionUtils –> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>28.1-jre</version> </dependency> <!– StringUtils –> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </dependency> <! — JSON special toolkit — > <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.62</version> </dependency> JSON tool class Serverresponse – Generic JSON response object Responsecode is an enumeration class that encapsulates code and desc package com.mmall.common; import […]