Skip to content

evanstjabadi/rdbbeat-flask-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask Example for rdbbeat

This is a simple example of how to use rdbbeat with Flask.

Getting Started with rdbbeat

  • Clone this repo
  • Install the requirements in requirements.txt (preferably in a virtualenv)
  • Start Redis on localhost:6379/0 or update the REDIS_URL in the celery_worker.py if your url is different
  • Start postgres database and put the DATABASE_URL in the .env file. E.g, DATABASE_URL="postgresql://username:password@localhost:5432/database"
  • Put FLASK_APP=server/app.py in the .env file.
  • Run rdbbeat migration: python -m alembic -n scheduler upgrade head
  • Run the example's migrations: python -m flask db upgrade (you may need export FLASK_APP=server.app first)

Running the example

  • Open 3 different terminals and run each command in each.
  • Run the flask server: python -m flask run
  • Run the celery worker: python -m celery --app=server.tasks worker --loglevel=info
  • Run celery beat with custom scheduler: python -m celery --app=server.tasks beat --loglevel=info --scheduler=rdbbeat.schedulers:DatabaseScheduler

Output

terminals' outputs

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published