Git Product home page Git Product logo

django-celery-app's Introduction

Django Celery Simple App

Introduction

This is a simple app with only 2 celery tasks for demonstrating the async tasks in celery

Technologies

Django Celery App uses a number of open source projects to work properly:

  • Python - is a class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible.
  • Pip - is a package-management system written in Python used to install and manage software packages.
  • Django - is an open source asynchronous task queue or job queue which is based on distributed message passing. While it supports scheduling, its focus is on operations in real time.
  • Celery - is architectural style for distributed hypermedia systems.
  • Flower - is a web based tool for monitoring and administrating Celery clusters
  • Docker - is a set of platform as a service (PaaS) products that use OS-level virtualization.

Install and run

$ Clone the repository and go into the project
$ Create a virtual env and activate it
$ Install the reqirements using this command `pip install requirements.txt`
$ Migrate using this command `python manage.py migrate`
$ Craete superuser using this command `python manage.py createsuperuser`
$ Run the application using this command `python manage.py runserver`
$ The app should be up and running on localhost:8000
$ The app admin should be up and running on localhost:8000/admin

Run Redis

$ Install docker on your local machine
$ Run redis using the following command `docker run --name my-redis-server -d -p 127.0.0.1:6379:6379 redis`

Run celery and flower

$ In new terminal run celery using `celery -A django_celery worker -l info -P solo`
$ In new terminal run flower using `celery -A django_celery flower`
$ Flower app should be up and running on localhost:5555

Testing

$ Open django shell using this command `python manage.py shell`
$ Import debug task `from django_celery.celery import debug_task`
$ Import create user task `from core.tasks import create_user`
$ Create instance of debug task `debug_task.apply_async(countdown=10)`
$ Check the result in celery terminal and flower
$ Create instance of debug task `create_user.apply_async(countdown=10)`
$ Check the result in celery terminal and flower
$ Login to admin and check if new user created 

Todos

  • Dockerize the application
  • Use docker compose to simplify the project run and deployment

django-celery-app's People

Contributors

fadyalfred avatar

Watchers

James Cloos avatar  avatar

Forkers

desmonty-vinter

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.