django_deploy Flashcards
What is WSGI in the context of Django deployment?
WSGI stands for Web Server Gateway Interface. It is a standard for communication between web servers and Python web applications, supporting synchronous code only.
What does the wsgi.py file do in a Django project?
The wsgi.py file declares an application callable, which is used by WSGI servers as an entry point to communicate with the Django app.
Name some popular WSGI web servers for Django apps.
Popular WSGI web servers for Django apps include Gunicorn, uWSGI, Apache, and mod_wsgi.
What is ASGI and how does it differ from WSGI?
ASGI stands for Asynchronous Server Gateway Interface and supports asynchronous code, whereas WSGI supports only synchronous code.
What does the asgi.py file do in a Django project?
The asgi.py file declares an application callable for ASGI servers to communicate with the Django app.
Name some popular ASGI web servers for Django apps.
Popular ASGI web servers for Django apps include Daphne, Hypercorn, and Uvicorn.
What are some hosting options for running a Django app on the cloud?
Hosting options for running a Django app on the cloud include using a virtual machine (VM), platform-as-a-service (PaaS) like Heroku, and containerization with Docker and Kubernetes.
Which databases are officially supported by Django?
Django officially supports PostgreSQL, MariaDB, MySQL, Oracle, and SQLite.
Why should you avoid using SQLite in production?
SQLite is not designed for high concurrency or heavy traffic, making it unsuitable for production environments.
How should you handle database credentials in a Django app?
Database credentials and other sensitive information should be stored in environment variables and never hard-coded in the application.
Why is it important to use HTTPS for your Django app in production?
HTTPS ensures secure communication between the server, the hosted Django app, and clients, protecting data from interception and tampering.
What is the recommended way to serve static and media files in production?
Use a cloud storage service or content delivery network (CDN) to efficiently serve static files and user-uploaded media files, reducing server load.
What is the role of a load balancer in a Django deployment?
A load balancer distributes incoming traffic across multiple instances of the Django app, ensuring high performance and availability.
What does horizontal scaling involve in the context of a Django app?
Horizontal scaling involves adding more instances or containers of the Django app as traffic increases, enhancing scalability and performance.
Why is monitoring and logging important for a Django app in production?
Monitoring and logging services help track and diagnose issues, ensuring the reliability and smooth operation of the Django app in production.