Skip to content

Car configurator in Python/Django for Mercedes partners. RabbitMQ and Celery: Distributed Task Queue

Notifications You must be signed in to change notification settings

sezabart/Configurator-in-Python-and-Django

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Configurator-in-Python-and-Django

Python Django Crispy forms WeasyPrint RabbitMQ Celery

Creating a car design, configuration and automatic ordering of your own Mercedes transport vehicle.

Main functionality

  • Application management through the content management system (CMS)
  • Configuring the advanced specification of the car according to individual needs
  • Generating order specifications in a PDF file and adding it to send orders by email
  • Automatically ordering and sending an email to customers
  • Saving and editing orders and saving generated files to the database

Technology

Web application based on the Django Framework on Backend.

Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel. It’s free and open source.

Source: www.djangoproject.com

Configurator uses Crispy forms and Bootstrap library on Frontend.

Django crispy forms is a Django application that lets you easily build, customize and reuse forms using your favorite CSS framework, without writing template code and without having to take care of annoying details. Django crispy forms provides you with a crispy filter and crispy tag that will let you control the rendering behavior of your Django forms in a very elegant and DRY way. Have full control without writing custom form templates. All this without breaking the standard way of doing things in Django, so it plays nice with any other form application.

Source: http://django-crispy-forms.readthedocs.io

Message broker is RabbitMQ and distributed task queue is Celery.

RabbitMQ is the most widely deployed open source message broker. RabbitMQ is lightweight and easy to deploy on premises and in the cloud. It supports multiple messaging protocols. RabbitMQ can be deployed in distributed and federated configurations to meet high-scale, high-availability requirements.

Source: www.rabbitmq.com

Celery is an asynchronous task queue/job queue based on distributed message passing. It is focused on real-time operation, but supports scheduling as well. The execution units, called tasks, are executed concurrently on a single or more worker servers using multiprocessing, Eventlet, or gevent. Tasks can execute asynchronously (in the background) or synchronously (wait until ready).

Source: www.celeryproject.org

WeasyPrint converting HTML/CSS documents to PDF format.

WeasyPrint is a visual rendering engine for HTML and CSS that can export to PDF. It aims to support web standards for printing. WeasyPrint is free software made available under a BSD license.

Source: www.weasyprint.org

Otherwise: HTML5, CSS3, jQuery, PostgreSQL, SQLite

Instalation

Make sure the pyc magic numbers are fresh for your version of python using the steps in the following post: https://stackoverflow.com/questions/514371/whats-the-bad-magic-number-error

Dependencies are installed using the command:

pip install -U -r requirements.txt

If you are using a venv make sure celery and crispy forms are installed as well for the user.

pip install --user celery
pip install --user django-crispy-forms
pip install --user cripsy-bootstrap3

To properly send an e-mail with a pdf file, complete the lines with the appropriate data in the settings.py file

EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'email'
EMAIL_HOST_PASSWORD = 'pass'

Automatic database creation.

First of all, in the event of a change, we must prepare a migration for the previously created new model. From the main project level, issue the following command.

python manage.py makemigrations app

We will now synchronize the database with the new model. Issue the following command to apply existing migrations.

python manage.py migrate

To manage the administration site, we need a superuser, so from the shell level, issue the following command.

python manage.py creatinguperuser

Run applications in the console with the command:

python manage.py runserver

RabbitMQ required. Use this helpful post for ubuntu: https://www.cherryservers.com/blog/how-to-install-and-start-using-rabbitmq-on-ubuntu-22-04

After installation, launch RabbitMQ using the following command issued in the shell.

RabbitMQ-server

Go to the next shell and start the Celery worker thread using the following command.

celery -A app worker -l info

The host will default to 128.0.0.1:8000

Summation

Python is a programming language that lets you work quickly and integrate systems more effectively.
Django makes it easier to build better Web apps more quickly and with less code.
PyPI helps you find and install the required software.
The plugs are easy to install and configure.

About

Car configurator in Python/Django for Mercedes partners. RabbitMQ and Celery: Distributed Task Queue

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 96.9%
  • HTML 1.0%
  • JavaScript 0.8%
  • CSS 0.8%
  • C 0.5%
  • PowerShell 0.0%