Django

Django Deployment

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

24 domande da colloquio·
Mid-Level
1

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

Risposta

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?

Risposta

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?

Risposta

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 domande da colloquio

Padroneggia Django per il tuo prossimo colloquio

Accedi a tutte le domande, flashcards, test tecnici, esercizi di code review e simulatori di colloquio.

Inizia gratis