Skip to content
This repository was archived by the owner on Feb 18, 2020. It is now read-only.

gGonz/django_celery_example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django + Celery example

This is a very basic and useless example of Celery extending Django with asynchronous tasks, it consist of a simple task that counts to the provided number and sleeps one second in every iteration, using AJAX to check the status of this task from the client side.

This example makes use of a virtual machine that runs the Django server and the Redis backend for Celery.

Prerequisites

A development environment that runs Git, Oracle's VirtualBox, Vagrant, Python and Fabric.

Configuring your virtual environment

  1. Clone the reposiroty.
$ git clone git@github.com:gGonz/django_celery_example.git
  1. Create the virtual machine.
$ cd django_celery_example
$ vagrant up
  1. Build the environment inside the virtual machine.
$ fab vagrant bootstrap
  1. Run Celery on the virtual machine.
$ vagrant ssh                               # ssh into the virtual machine
$ cd django_site                            # cd into the site directory
$ nohup python manage.py celery worker &    # run Celery in the background
$ exit                                      # close the ssh session
  1. Run the virtual server.
$ fab vagrant runserver
  1. Open your browser and go to your virtual server on http://127.0.0.1:8000

Celery official documentation

http://docs.celeryproject.org/en/latest/index.html

About

A very basic and useless Celery task example for Django.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors