Skip to main content

Flask module to auto setup and manage the project and its configurations (app code, templates, databases...)

Project description

flask_man

Flask module to auto setup and manage the project and its configurations (app code, templates, databases...)

Why should I use flask_man's framework?


flask_man will do most of the work for you ! ALL and KEEPING THE FLEXIBILITY AND SIMPLICITY OF FLASK !!

  • Create necessary codes, database, tables, files and folders when you initialize the project, leaving to you only editing the templates and adding some code to "template.py and "routes.py" when needed !
  • Add/Delete routes/templates to/from the project's files and code in "template.py and "routes.py"
  • Compatible with: SQLite, MySQL, MariaDB, PostgreSQL, Oracle SQL and MS SQL. You can switch between them with a single command any time.
  • Create/Delete models for/from the project.
  • Built-in functions ( in "utils.py" , "database.py" and "handlings.py") and decorators ( in "wrappers.py" ) to minimize the amount of code you write and maximize the security level of the projects.
  • Have customizable configurations at "settings.py" which most of them are loaded from "config.json" ( created on the project's creation ) which is also updated when the configurations are changed, every time the application starts.
  • Save files locally, filter them by their mimetypes and extensions, and serve them securily.
  • Upload files to firebase.
  • Users authentication and management with firebase ( create / update / delete / signup / signin / lookup / reset password ... ).
  • Send mail.
  • Send SMS ( you need an account here and get you API Key and Secret Key ) .
  • High level access control ( visitor , user , admin ) achieved with the decorators.
  • Secure the application from SQL-Injection by auto-escape: URL arguments, request's body's parameters and dynamic URIs.
  • Supports JWT-Authentication.
  • Supports CORS for REST API on specific routes.
  • CSRF protection by: session's cookie's samesite='Lax' , checking the referer header and/or CSRF token.
  • Supports rate-limit and google's reCAPTCHA v2.
  • Clickjacking protection.
  • XSS protection.
  • CORS's protection by validating the origin of the request.
  • Built-in functions to validate user's input against: SSRF and Path Traversal.
  • Ready to deploy directly on Heroku or shared Hosting site.
  • Create an instant backup for all your project's files.
  • Have a nice debug toolbar containing useful information for debugging.

The security in the this project is achieved via sanitizy

Usage:

Usage:
    flask_man [args...]

args:

    manager: to launch the web interface and manage the project from there


    examples: to show commands examples


    upgrade: to upgrade to the latest version of flask_man package


    init: to create "config.json" and python files that contains
          code and setup configurations, and to install required packages


    db: to choose database type to use ( sqlite or mysql or mariadb or postgresql or mssql or oracle )


    add_template: create a template file with that path in the
                  templates folder,add the name to the "config.json"
                  file and add necessary code to "templates.py"


    delete_template: delete the template file with that path from the
                     templates folder, remove the name from the
                     "config.json" file and delete the code from "templates.py"


    add_route: add the name to the "config.json" file and
               add necessary code to "routes.py"


    delete_route: remove the name from the "config.json"
                  file and delete the code from "routes.py"


    add_model: add the name to the "config.json" file and
               add necessary code to "models.py"


    delete_model: remove the name from the "config.json"
                  file and delete the code from "models.py"


    firebase_apikey: set the firebase APIKey


    firebase_bucket: set the firebase storage bucket


    firebase_configs: copy the firebase storage bucket's configs'
                      file to the local configs file


    pro: set project to production mode


    dev: set project to development mode

Manager

To use flask_man's manager run the following commands ( suppose we will call the project "flask_proj" ) :

mkdir flask_proj

cd flask_proj

flask_man manager

then open this link :

http://127.0.0.1:12345/

Running the application

python app.py
or
python3 app.py

Commands examples:

You can also manage your project from the command line with the following commands ( just examples ) :

** Launching the web interface:

Example:

    flask_man manager

** Upgrading the package:

Example:

    flask_man upgrade

** Creating a Project:

Example 1 (database: SQLite) :

    flask_man init config
    flask_man db sqlite
    flask_man init app
    flask_man init install

Example 2 (database: MySQL/MariaDB) :

    flask_man init config
    flask_man db mysql
    flask_man init app
    flask_man init install

Example 3 (database: PostgreSQL) :

    flask_man init config
    flask_man db postgresql
    flask_man init app
    flask_man init install

Example 4 (database: MS SQL) :

    flask_man init config
    flask_man db mssql
    flask_man init app
    flask_man init install

Example 5 (database: Oracle SQL) :

    flask_man init config
    flask_man db oracle
    flask_man init app
    flask_man init install

** Installing the requirements:

Example:

    flask_man init install

** Add a template to the project:

Example:

    flask_man add_template "admin/login.html"

** Remove a template from the project:

Example:

    flask_man delete_template "admin/login.html"

** Add a model to the project:

Example:

    flask_man add_model "user"

** Remove a model from the project:

Example:

    flask_man delete_model "user"

** Add a route to the project:

Example 1:

    flask_man add_route "admin/upload"

Example 2:

    flask_man add_route "/profile/<user_id>"

** Remove a route from the project:

Example 1:

    flask_man delete_route "admin/upload"

Example 2:

    flask_man delete_route "/profile/<user_id>"

** Set firebase APIKey:

Example :

    flask_man firebase_apikey "kjkhgyftrdfghjklkjhgfrdefg"

** Set firebase storage bucket:

Example :

    flask_man firebase_bucket "myfbbucket.appspot.com"

** Copy firebase storage bucket's config file to local config file:

Example 1 (Non-Windows):

    flask_man firebase_configs "/home/root/configs.json"

Example 2 (Windows):

    flask_man firebase_configs "C:\Users\user\Desktop\configs.json"

** Change Database type:

Example 1:

    flask_man db mysql

Example 2:

    flask_man db postgresql

** Go production:

Example :

    flask_man pro

** Go development:

Example :

    flask_man dev

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask_man-1.2.0.tar.gz (53.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page