Code Monkey home page Code Monkey logo

django-celery-api's Introduction

Cartloop Test

Backend Challenge for Cartloop. Django REST API + Celery.

How to set up

This installation guide presumes that you have virtualenvwrapper and docker installed on your system.

git clone [email protected]:joanpujol/testcartloop.git
cd testcartloop
# Make a new virtualenv
mkvirtualenv testcartloop -p `which python3.8`
pip install -r requirements/requirements.txt
python manage.py migrate

# In order to access the /admin/ panel which will enable you to create some needed model instances:
python manage.py createsuperuser

How to run

All the following must be run in different terminals so that they can work together.

# How to run the REST API
python manage.py runserver

# How to run RabbitMQ
docker run --rm -it --hostname my-rabbit -p 15672:15672 -p 5672:5672 rabbitmq:3-management

# How to run a Celery scheduler
celery -A testcartloop.celery beat

# How to run a Celery worker
celery -A testcartloop.celery worker --loglevel=info

How to test

The conversationss app contains a tests module which includes 3 test cases:

  • Endpoint tests
  • Scheduler module tests
  • Celery task test
# From the project directory run:
python manage.py test conversations

Configurations

From setting.py you can change the following configs:

  • MAX_MESSAGES_PER_HOUR
  • SENDING_INTERVAL_START
  • SENDING_INTERVAL_END

celery.py contains the crontab schedule that will activate the celery beat once an hour.

Additional notes

  • Some validation has been added accorded to the specification, it's located in the validators.py module within the conversations app.
  • A new model has been added for GroupOperator, which was hinted in the operator model specification but was not in the list explicitly.

django-celery-api's People

Contributors

joanpujol avatar

Watchers

Bogdan Tănase avatar  avatar

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.