https://github.com/gmaze/flask-template-tasks-manager
https://github.com/gmaze/flask-template-tasks-manager
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/gmaze/flask-template-tasks-manager
- Owner: gmaze
- License: other
- Created: 2023-11-20T14:23:22.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-01-15T16:20:27.000Z (over 1 year ago)
- Last Synced: 2024-06-11T16:42:17.254Z (12 months ago)
- Language: CSS
- Size: 4.12 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Flask template for a webapp with server tasks manager
This Flask app template is for the following use case:
- An authenticated user trigger one or more tasks from SAAS, on the server side
- Server execute tasks
- User can follow the status of tasks (queue, running, done, stalled, error, disk usage etc...)
- An admin dashboard allows to keep track of all running tasks on the server and usersThis template is to be used in the development of SAAS web-applications for the [VirtualFleet-Recovery](https://github.com/euroargodev/VirtualFleet_recovery) and [pyowc](https://github.com/euroargodev/argodmqc_owc) softwares.
UI design source: **[Flask Dashboard](https://appseed.us/admin-dashboards/flask/)** generated by `AppSeed` on top of a modern design.
## Manual Build
> Download the code
```bash
$ git clone https://github.com/gmaze/flask-template-tasks-manager.git
$ cd flask-template-tasks-manager
```### 👉 Set Up for `Unix`, `MacOS`
Install modules via `VENV`
```bash
$ virtualenv env
$ source env/bin/activate
$ pip3 install -r requirements.txt
```or via `mamba`
```bash
$ mamba env create -f environment.yml
$ conda activate
```Set Up Flask Environment
```bash
export FLASK_APP=run.py
export DEBUG=1
```Start the app
```bash
$ flask run
```At this point, the app runs at `http://127.0.0.1:5000/`.
## Codebase
The project is coded using blueprints, app factory pattern, dual configuration profile (development and production) and an intuitive structure presented bellow:
```bash
< PROJECT ROOT >
|
|-- apps/
| |
| |-- home/ # An app that serve HTML files
| | |-- routes.py # Define routes
| |
| |-- authentication/ # Handles auth routes (login and register)
| | |-- routes.py # Define routes
| | |-- models.py # Defines models
| | |-- forms.py # Define auth forms (login and register)
| | |-- util.py # Useful functions for authentication
| |
| |-- tasks/ # Handles tasks routes
| | |-- routes.py # Define routes
| | |-- models.py # Defines models
| | |-- forms.py # Define tasks submission forms
| |
| |-- subscriptions/ # Handles subscriptions routes
| | |-- routes.py # Define routes
| | |-- models.py # Defines models
| |
| |-- monitors/ # Handles monitors (routes and process)
| | |-- routes.py # Define routes
| | |-- models.py # Defines models
| | |-- src/ # Monitoring methods for each OS
| | | |-- __init__.html # Define Monitor Facade
| | | |-- sys_darwin.html # Mac OS component
| | | |-- sys_linux.html # Linux component
| |
| |-- admin/ # Handles admin panel routes
| | |-- routes.py # Define routes
| |
| |-- apis/ # Handles REST-API routes
| | |-- util.py # Useful functions for REST-API
| | |-- namespace_monitors.py # Handles API 'monitors' entry
| | |-- namespace_plans.py # Handles API 'plans' entry
| | |-- namespace_tasks.py # Handles API 'tasks' entry
| | |-- namespace_users.py # Handles API 'users' entry
| |
| |-- application/ # Handles specifics for this application
| | |-- worker.py # Receive 'tasks' API or 'tasks/launcher' form data and execute application script
| |
| |-- static/
| | |-- # CSS files, Javascript files
| |
| |-- templates/ # Templates used to render pages
| | |-- includes/ # HTML chunks and components
| | | |-- navigation.html # Top menu component
| | | |-- sidebar.html # Sidebar component
| | | |-- footer.html # App Footer
| | | |-- scripts.html # Scripts common to all pages
| | |
| | |-- layouts/ # Master pages
| | | |-- base-fullscreen.html # Used by Authentication pages
| | | |-- base.html # Used by common pages
| | |
| | |-- accounts/ # Authentication pages
| | | |-- login.html # Login page
| | | |-- register.html # Register page
| | |
| | |-- admin/ # App. admin pages
| | | |-- dashboard.html # Full system dashboard for admin
| | | |-- tasks.html # Tasks admin panel
| | | |-- users.html # Users admin panel
| | |
| | |-- tasks/ # App. admin pages
| | | |-- launcher.html # Tasks admin panel
| | |
| | |-- home/ # UI Kit Pages
| | | |-- index.html # Index page
| | | |-- page-404.html # 404 page
| | | |-- profile.html # User profile page
| | | |-- subscription-plans.html # Describe all available subscription plans
| | | |-- monitors.html # Server monitoring page
| | | |-- *.html # All other pages| |
| config.py # Set up the app
| __init__.py # Initialize the app
|
|-- requirements.txt # App Dependencies
|
|-- .env # Inject Configuration via Environment
|-- run.py # Start the app - WSGI gateway
|
|-- ************************************************************************
```