Flask CLI & Deploy Flask CLI (DFC)
Hi, in this post I want to let you know about a great project I'm working on together with 2 great people:
- Monica Maria Jaimes Caicedo: Full Stack Software Engineer https://www.garudax.id/in/m%C3%B3nica-jaimes-38aaa246/
- Jonathan Andres Cardenas Pabon: Full Stack Software Engineer https://www.garudax.id/in/jc-designs/
- David Rosero Calle: Full Stack Software Engineer https://www.garudax.id/in/david-rosero-calle-1aa6a2126/
So let's talk about Flask CLI:
Flask is a micro web framework written in Python. It is classified as a microframework because it does not require particular tools or libraries. It has no database abstraction layer, form validation, or any other components where pre-existing third-party libraries provide common functions. However, Flask supports extensions that can add application features as if they were implemented in Flask itself. Extensions exist for object-relational mappers, form validation, upload handling, various open authentication technologies and several common framework related tools.
FlaskCLI is a CLI for creates, manages, builds and test your Flask projects.
- Development tools
- Libraries specialized for Flask
- Magic
Flask CLI Goal
Building a Flask application gives a greater flexibility than many alternatives. As being a micro-framework, all the additional components are chosen and added separately.
The objective of FlaskCLI is to add components quickly and easily to the applications created under this stack.
Architecture that creates Flask CLI
.
├── api │ └── __init__.py │ └── v1 │ └── __init__.py │ └── app.py │ └── views │ └── __init__.py │ └── index.py ├── console.py ├── dbconsole.sh ├── dev │ └── export_enviroment.sh │ └── requirements.txt │ └── setup_mysql_dev.sql │ └── setup_mysql_test.sql ├── models │ └── __init__.py │ └── base_model.py │ └── engine │ └── __init__.py │ └── db_storage.py │ └── file_storage.py ├── web │ └── __init__.py │ └── app.py │ └── static │ │ └── images │ │ └── scripts │ │ └── 0-script.js │ │ └── styles │ │ └── 0-style.css │ └── templates │ └── 0-index.html └── build.sh
Deploy Flask CLI (dfc):
This package creates a Command Line Interpreter to deploy packages like NGINX, MySQL, Firewall apart from being able to deploy projects based on Flask CLI, it verifies its architecture and makes a deployment on a server, this CLI aims to save time in the deployment of projects apart from being able to install packages on another server.
Very important, in deploy Flask CLI we want to be able to integrate all flask cli functionalities, making projects based on Flask CLI easy to deploy
CMD:Build
This command contains the different services that can be built on the remote server
Build:Sub-commands
- nginx: Install nginx server on the remote server
- mysql: Install mysql server on the remote server
CMD:Deploy
This command is in charge of deploying a project under the NAFA architecture, this means that you need the following files and directories. Note that if at any time you want to add a directory or file this will be taken into account and will only require the following files
Sub-commands
- project: Deploys an application under the NAFA architecture, this deployment contains the configuration of the app, the execution and the recreation of the gunicorn as a daemon, if you have a project in other path, specify it as follows: export DFC_PATH.
As a base this project deploys the base with Nginx Server, Mysql-Server, Python, Vanilla JavaScript
In the deploy command, it will check the project path to see if it corresponds to Flask CLI, these are the directories and files that DFC will check:
. ├── My_project │ ├── api │ ├── models │ ├── web │ │ ├── app.py │ ├── dev │ │ ├──requirements.txt │ │ ├──setup_mysql_dev.sql
CMD:Integrate
This command makes the integration of the different services to the application possible, making the individual integration of each service
Sub-Commands
- mysql-storage: Integrate the previously displayed project with the database, if you do not find the project displayed, it cannot be executed
Flask CLI: https://github.com/guxal/Flask-CLI
Deploy Flask CLI (DFC): https://github.com/drc288/dfc