Django

Django Deployment

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

24 면접 질문·
Mid-Level
1

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.

2

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.

3

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.

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 면접 질문

다음 면접을 위해 Django을 마스터하세요

모든 질문, flashcards, 기술 테스트, 코드 리뷰 연습, 면접 시뮬레이터에 접근하세요.

무료로 시작하기