flask-reactize is a boostrap to serve any React JS application via a Python back-end, using Flask as web framework.

Overview

flask-reactize

Purpose

Developing a ReactJS application requires to use nodejs as back end server. What if you want to consume external APIs: how are you going to handle cross origin calls? What if you want to secure your application and APIs easily?

In modern days, as we are now, React JS offers many nice functionalities to develop an application easily, from any IDE.

In development mode, React JS requires NodeJS as a back end server. NodeJS maintains a connection between your development environment and your browser where the application is loaded so that:

  • it refreshes automatically when an update is made,
  • it sends in real time any error, warning that may have, in both the console and the developers toolbar of your browser of choice.

For production, you can compile your React JS application into static assets - you can then use any technology to serve those static files.

However, if your React JS calls external APIs (whether there are customs, or public) you will face security issues.

In addition, if your APIs require to be logged in, this is not going to be easy to implement.

What does flask-reactize do?

flask-reactize is a boostrap to serve any React JS via a Python back-end, using Flask as web framework.

Your back-end web server can be anything: Flask itself (Although not recommended for production), Uvicorn, Gunicorn etc.

In a nutshell, flask-reactize is a proxy for your React JS application and for your APIs.

Features list

  • It has a development mode: a nodejs server is transparently started by the Python back-end,
  • It supports production mode: this back-end can also serve your static assets,
  • It supports hot reload while developing: changing the Python code or the React code will trigger a browser refresh,
  • It supports proxying multiple APIs via a specific route name.

What you will find in this repo

  • Under src/flask-reactize you will find the Python module (also available via PyPi). More info
  • Under sample/ you will find a simple demo site built with React JS using flask-reactize. More info on how to use it.
  • Two DockerFile for Python 3.8 and Python 3.10. To run them,

Sample site: the short way using Docker

You want to try out quickly flask-reactize, follow the steps below:

  1. Ensure you have vscode installed because you are going to use DevContainers to have all prerequisites without any hassle. It is free and great!
  2. Once vscode is installed, install the extension Remote Development.
  3. Install docker if you do not already have it.

You are now ready!

In your favorite terminal (on Windows, WSL) run the following commands:

git clone https://github.com/jchomarat/flask-reactize /> cd flask-reactize # Open vscode /> code .">
# Clone the project
/> cd "wherever you want to work"
/> git clone https://github.com/jchomarat/flask-reactize
/> cd flask-reactize

# Open vscode
/> code .

Once in vscode, open the Palette (Ctrl+Shift+P / Cmd+Shift+P) and select the action Remote-Containers: Reopen in container. You can now grab a coffee while the container builds.

When the container is built, your vscode is fully operational. If you open the terminal built in vscode, you will be prompted directly inside the container, as a "dummy" user called alex.

You can now build the flask-reactize image. In the terminal (the one in vscode), run the following commands:

/> make docker-build-sample-py38 # for python 3.8
# or
/> make docker-build-sample-py310 # for python 3.10
# 'make' allows to call bash scripts/commands easily via actions

# When the command above has executed, run
/> make docker-run-sample

If running the commands above result in an access is denied for the file /var/run/docker.sock, ensure that your user is the owner of this file. If it is not the case, run

# Assume your dev container's user is alex
/> sudo chown alex:alex /var/run/docker.sock

You can now open your browser and load the url http://localhost:8080

Sample site: the long way

Ok, you want to do everything by yourself, no worries I got you covered!

Please note that you need to be on a *nix system for that, whether you are on Linux, Mac or Windows for WSL

Instructions to follow can be found here!

You might also like...
A web application made with Flask that works with a weather service API to get the current weather from all over the world.
A web application made with Flask that works with a weather service API to get the current weather from all over the world.

Weather App A web application made with Flask that works with a weather service API to get the current weather from all over the world. Uses data from

A multi-container docker application. Implemented and dockerized a web-based service leveraging Flask

Flask-based-web-service-with-Docker-compose A multi-container docker application. Implemented and dockerized a web-based service leveraging Flask. Des

Flask-Bcrypt is a Flask extension that provides bcrypt hashing utilities for your application.

Flask-Bcrypt Flask-Bcrypt is a Flask extension that provides bcrypt hashing utilities for your application. Due to the recent increased prevelance of

Flask-Bcrypt is a Flask extension that provides bcrypt hashing utilities for your application.

Flask-Bcrypt Flask-Bcrypt is a Flask extension that provides bcrypt hashing utilities for your application. Due to the recent increased prevelance of

The Snoopy boilerplate in flask framework for development enterprise application.

Snoopy What is snoopy! The "Snoopy" boilerplate in flask framework for development enterprise application. Motivation In my 10 years of development ex

flask-apispec MIT flask-apispec (šŸ„‰24 Ā· ā­ 520) - Build and document REST APIs with Flask and apispec. MIT

flask-apispec flask-apispec is a lightweight tool for building REST APIs in Flask. flask-apispec uses webargs for request parsing, marshmallow for res

Flask Web DRY full-stack framework by Problem Fighter

In the name of God, the Most Gracious, the Most Merciful. PF-Flask-Web Documentation Install and update using pip: pip install -U PF-Flask-Web Please

Lux Academy & Data Science East Africa Python Boot Camp, Building and Deploying  Flask Application Using Docker  Demo App.
Lux Academy & Data Science East Africa Python Boot Camp, Building and Deploying Flask Application Using Docker Demo App.

Flask and Docker Application Demo A Docker image is a read-only, inert template that comes with instructions for deploying containers. In Docker, ever

Neo4j Movies Example application with Flask backend using the neo4j-python-driver
Neo4j Movies Example application with Flask backend using the neo4j-python-driver

Neo4j Movies Application: Quick Start This example application demonstrates how easy it is to get started with Neo4j in Python. It is a very simple we

Releases(1.0.0a3)
Owner
Julien Chomarat
Software Engineer at Microsoft, focusing mostly on Azure services
Julien Chomarat
A weather report application build with Python, Flask, and Geopy.

A weather report application build with Python, Flask, and Geopy. Requirements Python 3

Brandon Wallace 6 May 07, 2022
HTTP security headers for Flask

Talisman: HTTP security headers for Flask Talisman is a small Flask extension that handles setting HTTP headers that can help protect against a few co

Google Cloud Platform 853 Dec 19, 2022
Getting Started with Docker and Flask

Getting-Started-with-Docker-and-Flask Introduction Docker makes it easier, simpler and safer to build, deploy and manage applications in a docker cont

Phylis Jepchumba 1 Oct 08, 2021
Flask pre-setup architecture. This can be used in any flask project for a faster and better project code structure.

Flask pre-setup architecture. This can be used in any flask project for a faster and better project code structure. All the required libraries are already installed easily to use in any big project.

Ajay kumar sharma 5 Jun 14, 2022
An Instagram Clone using Flask, Python, Redux, Thunk, React

An Instagram Clone using Flask, Python, Redux, Thunk, React

1 Dec 09, 2021
Flask-Bcrypt is a Flask extension that provides bcrypt hashing utilities for your application.

Flask-Bcrypt Flask-Bcrypt is a Flask extension that provides bcrypt hashing utilities for your application. Due to the recent increased prevelance of

Max Countryman 310 Dec 14, 2022
Guitar tabs web app for guitar fans, powered by Python/Flask

Guitar123 version 0.8.5 Guitar tabs web app for guitar fans, powered by Python/Flask Features Guitar tabs search and browse Easy to use for end user a

lowrain 48 Dec 27, 2022
iloveflask is a Python library to collect functions that help a flask developer generate reports, config files and repeat code.

I Love Flask iloveflask is a Python library to collect functions that help a flask developer generate reports, config files and repeat code. Installat

2 Dec 29, 2021
Criando um Bot com PYAUTOGUI e utilizando o Flask para Interface para UsuƔrio

Criando um Bot com PYAUTOGUI e utilizando o Flask para Interface para UsuĆ”rio O pyautogui foi escolhido pela possibilidade de fazer a identificaĆ§Ć£o do

Rodrigo Vital 2 Oct 20, 2021
MongoEngine flask extension with WTF model forms support

Flask-MongoEngine Info: MongoEngine for Flask web applications. Repository: https://github.com/MongoEngine/flask-mongoengine About Flask-MongoEngine i

MongoEngine 815 Jan 03, 2023
Library books management program, built with Flask, Python

Library books management program, With many features and good User Interface. built with Flask, Python. (Include Screenshots) and documentation on how to run it! Thank you :)

Thierry Mugisha 1 May 03, 2022
Learn python and flask,just a tony blog system

flaskblog Learn python and flask,just a tony blog system based on flask and mysql It is similar to cleanblog, a blog system based on flask and mongoen

shin 174 Dec 01, 2022
Flask-Diamond is a batteries-included Flask framework.

Flask-Diamond Flask-Diamond is a batteries-included Python Flask framework, sortof like Django but radically decomposable. Flask-Diamond offers some o

Diamond Methods 173 Dec 22, 2022
Ɖ uma API feita em Python e Flask que pesquisa informaƧƵes em uma tabela .xlsx e retorna o resultado.

API de rastreamento de pacotes Ɖ uma API feita em Python e Flask que pesquisa informaƧƵes de rastreamento de pacotes em uma tabela .xlsx e retorna o r

Marcos Beraldo Barros 4 Jun 27, 2021
A live chat built with python(flask + gevent + apscheduler) + redis

a live chat room built with python(flask / gevent / apscheduler) + redis Basic Architecture Screenshot Install cd /path/to/source python bootstrap.py

Limboy 309 Nov 13, 2022
Rich implementation for Flask

Flask Rich Implements the Rich programming library with Flask. All features are toggleable, including: Better logging Colorful tracebacks Usage Import

BD103 13 Jun 06, 2022
A basic JSON-RPC implementation for your Flask-powered sites

Flask JSON-RPC A basic JSON-RPC implementation for your Flask-powered sites. Some reasons you might want to use: Simple, powerful, flexible and python

Cenobit Technologies 272 Jan 04, 2023
SqlAlchemy Flask-Restful Swagger Json:API OpenAPI

SAFRS: Python OpenAPI & JSON:API Framework Overview Installation JSON:API Interface Resource Objects Relationships Methods Custom Methods Class Method

Thomas Pollet 365 Jan 06, 2023
Intranet de la Rez Flask web app

IntraRez Application Flask de l'Intranet de la Rez. Exigences Python : Probablement = 3.10 Ć  terme, pour l'instant = 3.8 suffit ; Autres packages Li

3 Jul 03, 2022
A simple Task todo application built with Flask

Task TODO Table An application built with Flask a Python framework and hosted on Heroku. Important notes GuniCorn (Green Unicorn): is a Python WSGI HT

DCN (Dubem Celestine Nwabuisi) 1 Dec 15, 2021