Skip to content

This is a template for web-applications with Python 3 Flask, a React frontend, a separate Express web server and Webpack bundling.

Notifications You must be signed in to change notification settings

seanlau555/Flask-Express-React

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask-Express-React

This is a template for web-applications with Python 3 Flask, a React frontend, a separate Express web server and Webpack bundling.

Why a separate web server?

The Flask application could just serve the React application directly. Serving the website from a Node.js Express server instead has several advantages such as server-side rendering and webpack hot-reloading.

Development

First you will need to install the Node.js and Python dependencies.

npm i
virtualenv .venv && source .venv/bin/activate && pip install -r requirements.txt

Then you should use two separate terminals or bash jobs to run the web and API servers. Then visit http://localhost:8080

npm start web:dev
npm start api:dev

You may want to remove package-lock.json from .gitignore.

Production Deployment

You must build the webpack bundle and transpile the server-side code for production use. We also highly recommend using a production-grade WSGI like Gunicorn for the Flask component.

npm run build
npm start web
gunicorn -w 4 application.api.main:app


Licensed under WTFPL

About

This is a template for web-applications with Python 3 Flask, a React frontend, a separate Express web server and Webpack bundling.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published