Django

Django Deployment

WSGI, ASGI, Gunicorn, uWSGI, nginx, static files, environment variables, production settings

24 perguntas de entrevista·
Mid-Level
1

What does the acronym WSGI stand for in the context of Python deployment?

Resposta

WSGI stands for Web Server Gateway Interface. It's a standardized specification (PEP 3333) that defines how a web server communicates with a Python application. This interface provides an abstraction layer between the web server and the application, making Python applications portable across different WSGI-compatible servers like Gunicorn, uWSGI or mod_wsgi.

2

Which Django command collects all static files into a single directory for production?

Resposta

The collectstatic command gathers all static files from each Django app and directories defined in STATICFILES_DIRS into the directory specified by STATIC_ROOT. This step is essential in production because the web server (nginx for example) serves these files directly without going through Django, significantly improving performance.

3

What value should the DEBUG setting have in a Django production environment?

Resposta

DEBUG must be set to False in production. When DEBUG is True, Django displays detailed error pages containing sensitive information (environment variables, configuration, stack traces) that could be exploited by attackers. Additionally, Django keeps all executed SQL queries in memory when DEBUG is True, causing memory leaks on a production site.

4

What is the main role of Gunicorn in a Django deployment stack?

5

What is the purpose of the ALLOWED_HOSTS setting in Django?

+21 perguntas de entrevista

Domine Django para sua proxima entrevista

Acesse todas as perguntas, flashcards, testes tecnicos, exercicios de code review e simuladores de entrevista.

Comece gratis