Fundamentos de Deployment y Control de Versiones

1

¿Cómo Desplegar Aplicaciones Python?

2

Introducción a WSGI y ASGI para aplicaciones Python

3

Control de versiones en Git y prácticas de versionamiento en Python

4

Configuración de entornos de desarrollo para despliegue

5

Buenas prácticas en el uso de variables de entorno

Configuración de Servidores en la Nube para Despliegue

6

Fundamentos de servidores y conexión por SSH

7

Creación y configuración de instancias en AWS, Linode y DigitalOcean

8

Creación de instancias en AWS

9

Configuración de SSH

10

Instalación y gestión de paquetes en el servidor

11

Configuración de DNS para dominios en despliegue

12

Certificados SSL con Let’s Encrypt para seguridad en producción

Administración y Optimización de Servidores para Producción

13

Configuración de servidores web y aplicaciones con WSGI y ASGI

14

¿Cómo configurar UWSGI con Python y NginX en producción?

15

Configuración de Proxy Reverso en Nginx para Aplicaciones WSGI

16

Manejo de errores y configuración de logs en producción

17

Monitoreo de aplicaciones Python en producción usando Sentry

18

¿Cómo configurar un archivo .env en Django para producción?

Integración de Servicios Complementarios para Aplicaciones Python

19

Configuración de Bases de Datos PostgreSQL en el Servidor de la Aplicación

20

Configuración de Bases de Datos en Producción con Amazon RDS

21

Servicios para archivos estáticos (S3, Cloudflare)

Automatización y CI/CD para Despliegues Python

22

Automatización de despliegue con Ansible

You don't have access to this class

Keep learning! Join and start boosting your career

Aprovecha el precio especial y haz tu profesión a prueba de IA

Antes: $249

Currency
$209
Suscríbete

Termina en:

0 Días
14 Hrs
46 Min
57 Seg

Manejo de errores y configuración de logs en producción

16/22
Resources

Why is it crucial to configure logs in your Python applications?

When deploying our Python applications, it is normal for them to work correctly at first. However, as changes are made or specific scenarios occur, errors may arise. Setting up detailed logs is essential not only to detect failures more easily, but also to group them according to the running application, simplifying the diagnosis and correction process. Logs allow to identify and solve problems efficiently by providing historical records of the events and errors that occur.

How to structure logs in Django applications with Nginx and UWSGI?

To optimize log management, it is important to group them within your Django applications, aligned with web servers such as Nginx and application managers such as UWSGI. The methodology to achieve this goal is described below:

  1. Git branches and code changes:

    • Uses branches such as develop to create and test changes before merging them to main or production.
    • Verify and apply migrations or updates according to changes made.
  2. Review and install new dependencies:

    • Activate the virtual environment and run:
      pip install -r requirements.txt.
    • Restart the application service with:
      sudo service uwsgi restart
  3. Understand the importance of logs:

    • Logs set the basis for identifying errors, especially detecting HTTP response codes (such as 400, 500, etc.) and their underlying causes.
  4. Strategy for debugging and security logs:

    • Temporarily enable debug mode in Django, but be careful not to leave it active in production, as it exposes sensitive information such as IP addresses and configuration details.
    • When troubleshooting, disable debug and verify that configurations are returned to their original state to maintain security.
  5. Group and structure logs in Nginx:

    • Edit the Nginx configuration file (e.g., in /etc/nginx/sites-enabled/) to specify separate log locations:
      access_log /var/log/nginx/deploy_with_python_access.log;error_log /var/log/nginx/deploy_with_python_error.log;
    • Verify the configuration with:
      sudo nginx -t
    • Restart Nginx to apply the changes:
      sudo service nginx restart

How to monitor the logs for effective analysis?

After configuring the logs correctly, it is time for proactive monitoring:

  1. Dynamic log monitoring:

    • You can use the tail command to track real-time changes in your log files:
      sudo tail -f /var/log/nginx/deploy_with_python_access.log
  2. Identify and verify requests and errors:

    • Use the logs to view incoming requests and verify HTTP response codes to detect incidents or confirm normal operation.

As a next step in your log management mastery, you are challenged to configure UWSGI to store its logs in application-specific files, thus complementing the logging strategy initiated with Nginx. This not only gives you detailed insight into your application's performance, but also enhances your ability to effectively address and resolve potential problems.

Contributions 0

Questions 0

Sort by:

Want to see more contributions, questions and answers from the community?