[Flask - Celery - Redis - sqlite] starter template for performing async tasks
About The Project
pyAsyncFlow is a Python Flask app that enables users to perform async tasks seamlessly. The app allows users to execute time-consuming tasks in the background without affecting the performance of the main application. It's designed to handle tasks that run concurrently, making it possible to perform multiple tasks at once without slowing down the system.
locally
Running the code 💡 Before proceeding make sure you have Redis installed in your system
To run the code locally, open Terminal in your projects
folder and take the steps:
# STEP 1: Get sources from GitHub
$ git clone https://github.com/aregtech/areg-sdk.git
$ cd pyAsyncFlow
# STEP 2: Install the requirements
$ pip3 install -r requirements.txt
# STEP 3: Running the app
# You'l need to exceute 3 different commands in sequence, (preferably in 3 seperate terminal tabs)
# 1.
$ redis-server # Make sure you have redis installed on your system before this step.
# 2.
$ python3 -m celery -A tasks.celery worker --concurrency=3 --loglevel=info --without-mingle
# 3.
$ python3 main.py
Deploying the app
I personally prefer Railway.
STEPS:
After importing the project into the Railway dashboard.
-
Update the
Start
command field. More details hereNavigate to Settings tab → Deploy subsection → Start Command, to make the changes.
redis-server & celery -A tasks.celery worker --concurrency=3 --loglevel=info --without-mingle & python3 main.py
-
Add the
NIXPACKS_PKGS
environment variable.Navigate to Variables tab → New Variable button → Add the variable name and value.
NIXPACKS_PKGS : python39Packages.celery, ffmpeg, python39Packages.redis, redis