.. django_server: Django Server ============= Install Redis ------------- `Redis `_ improves performance by storing frequently accessed data in memory, reducing database queries. It is used in Django for caching, session management, and as a message broker to improve performance and enable real-time features. To speed up cache access, the faster in-memory cache Redis is used. Install Redis: .. code:: sudo apt-get install redis-server Ensure that the Redis server is running: .. code:: sudo service redis-server start | Django Service -------------- According to the `following description `__ a service has been created for Django Server. The description both includes Google Cloud Platform and Raspberry Pi. 1. django-server.service Script ``django-server.service`` installed in directory ``/etc/systemd/system/``. The Script starts the Django Server on Debian Linux. Example of the script **django-server.service**: .. code:: sudo nano /etc/systemd/system/django-server.service Content: .. code:: [Unit] Description=Handling of the Django Server After=multi-user.target [Service] Type=simple ExecStart=/usr/local/logistics/Python/venv/django_webapps_fullstack/bin/python3 \ /usr/local/logistics/Python/repo/django_webapps_fullstack/manage.py \ runserver --insecure 0:8000 \ --certificate /etc/letsencrypt/live/dingx.co/fullchain.pem \ --key /etc/letsencrypt/live/dingx.co/privkey.pem Restart=on-abort [Install] WantedBy=multi-user.target | 2. Start and Stop of the Server Reload Systemd to read the new service unit file: .. code:: sudo systemctl daemon-reload Enable the service to start at boot: .. code:: sudo systemctl enable django-server Start of the Server .. code:: sudo systemctl start django-server Stop of the Server .. code:: sudo systemctl stop django-server Status of the Server .. code:: sudo systemctl status django-server