Flask pre-setup architecture. This can be used in any flask project for a faster and better project code structure.

Overview

Flask-Architecture

This project has required python packages that's use in any flask normal or big project setup.

Files and folder structure are easy to use and configurable.


Root file of this project begin with application file.

  1. application.py

This file contains initialization for extensions with flask instance and flask object setup for run project with environment, host and port settings. There is AppSetting folder in this have extension, configuration and response file.

  1. extension.py

Extensions file have all objects of required libraries and we can use these in our project apps and initialize these with flask object in application file.

  1. configuration.py

Configuration file have flask app config variables that need to config with flask object.

  1. response.py

Response file have common api response model enum.


App Structure

We already created app for you AuthApp. Use this for user related staff. In this project structure we create apps like and create files with same names like AuthApp. App have 5 files app, models, query, router and schema.

  1. app.py

This file contains flask blueprint object and flask restx namespace object. Blueprint object and Namespace object initialize and add with flask object and rest api object that's imported from extension file. We use this namespace object to create our routes.

  1. router.py

This file is for create api using our namespace object.

  1. models.py

Model file containing database model. In this we are using db object from extension file.

  1. schema.py

Schema file work with marshmallow and database models. It's used to convert data types.

  1. query.py

Query file use for create separate methods for CRUD operations on models.


On root have a .env file that's have your project details like host, port, environment settings and also having secret key, database schema url. We just need to enter our details in this file according to variables.


Setup this project on your local follow these steps.

  1. Create a virtual environment.
  2. Activate created virtual environment.
  3. Install all required python packages from requirements.txt file.
  4. Update your .env file with your database url, server host & port, secret key, runtime environment.

Now we can run our server.

Run flask server flask run

Flask database migrations steps

  1. Initialize db migration flask db init.
  2. Migrate models to database flask db migrate -m " " .
  3. To upgrade changes flask db upgrade.
  4. To downgrade changes flask db downgrade.

You might also like...
Flask-Starter is a boilerplate starter template designed to help you quickstart your Flask web application development.
Flask-Starter is a boilerplate starter template designed to help you quickstart your Flask web application development.

Flask-Starter Flask-Starter is a boilerplate starter template designed to help you quickstart your Flask web application development. It has all the r

A Fast API style support for Flask. Gives you MyPy types with the flexibility of flask
A Fast API style support for Flask. Gives you MyPy types with the flexibility of flask

Flask-Fastx Flask-Fastx is a Fast API style support for Flask. It Gives you MyPy types with the flexibility of flask. Compatibility Flask-Fastx requir

Flask-app scaffold, generate flask restful backend

Flask-app scaffold, generate flask restful backend

Pf-flask-rest-com - Flask REST API Common Implementation by Problem Fighter Library

In the name of God, the Most Gracious, the Most Merciful. PF-Flask-Rest-Com Docu

Flask-Discord-Bot-Dashboard - A simple discord Bot dashboard created in Flask Python
Flask-Discord-Bot-Dashboard - A simple discord Bot dashboard created in Flask Python

Flask-Discord-Bot-Dashboard A simple discord Bot dashboard created in Flask Pyth

Open-source Flask Sample built on top of flask-dance library
Open-source Flask Sample built on top of flask-dance library

Open-source Flask Sample built on top of flask-dance library. The project implements the social login for Github and Twitter - Originally coded by TestDriven.IO.

Flask-redmail - Email sending for Flask

Flask Red Mail: Email Sending for Flask Flask extension for Red Mail What is it?

Flask Sitemapper is a small Python 3 package that generates XML sitemaps for Flask applications.

Flask Sitemapper Flask Sitemapper is a small Python 3 package that generates XML sitemaps for Flask applications. This allows you to create a nice and

Flask-template - A simple template for make an flask api

flask-template By GaGoU :3 a simple template for make an flask api notes: you ca

Owner
Ajay kumar sharma
Hi, Well I am a Software Developer with good experience in Python and JQuery. I love to develop projects in Django, Flask, Fast API, and Angular.
Ajay kumar sharma
Brandnew-flask is a CLI tool used to generate a powerful and mordern flask-app that supports the production environment.

Brandnew-flask is still in the initial stage and needs to be updated and improved continuously. Everyone is welcome to maintain and improve this CLI.

brandonye 4 Jul 17, 2022
Flask starter template for better structuring.

Flask Starter app Flask starter template for better structuring. use the starter plate step 1 : cloning this repo through git clone the repo git clone

Tirtharaj Sinha 1 Jul 26, 2022
A simple web application built using python flask. It can be used to scan SMEVai accounts for broken pages.

smescan A simple web application built using python flask. It can be used to scan SMEVai accounts for broken pages. Development Process Step 0: Clone

Abu Hurayra 1 Jan 30, 2022
Flask Application Structure with MongoDB

This application aims to serve as a template for APIs that intend to use mongoengine and flask-restx

Tiago Franco 5 Jun 25, 2022
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

Joshua Carp 617 Dec 30, 2022
Flask Project Template A full feature Flask project template.

Flask Project Template A full feature Flask project template. See also Python-Project-Template for a lean, low dependency Python app. HOW TO USE THIS

Bruno Rocha 96 Dec 23, 2022
REST API built using flask framework that used for managing bookmarks by individual users.

Bookmarks REST API REST API built using flask framework that used for managing bookmarks by individual users. API Consumers Note This app is built usi

Venkatesh Tantravahi 1 Dec 27, 2021
Flask-Rebar combines flask, marshmallow, and swagger for robust REST services.

Flask-Rebar Flask-Rebar combines flask, marshmallow, and swagger for robust REST services. Features Request and Response Validation - Flask-Rebar reli

PlanGrid 223 Dec 19, 2022
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
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 282 Feb 11, 2021