
Django Deployment
WSGI, ASGI, Gunicorn, uWSGI, nginx, static files, environment variables, production settings
1What does the acronym WSGI stand for in the context of Python deployment?
What does the acronym WSGI stand for in the context of Python deployment?
답변
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.
2Which Django command collects all static files into a single directory for production?
Which Django command collects all static files into a single directory for production?
답변
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.
3What value should the DEBUG setting have in a Django production environment?
What value should the DEBUG setting have in a Django production environment?
답변
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.
What is the main role of Gunicorn in a Django deployment stack?
What is the purpose of the ALLOWED_HOSTS setting in Django?
+21 면접 질문