# Django ## Deployment - The Django dev server is not production ready (which is obvious). - `gunicorn` - An actual [[web-server|web server]] is likely needed. Use `gunicorn` (WSGI) or `uvicorn` (ASGI) to run the Python program. - Django can serve static files but is not designed to, consider using an actual server like [[nginx|Nginx]] to serve the static files. ## Modern Django Stack - Django, as a server-driven framework, provides an efficient way to manage ORM, to render HTML, and to handle data rendering and authentication. - However, it lacks interactivity and rich UI that is expected from modern web experience. For example, when clicking a link, the whole web page is refreshed. Client side JavaScript (AJAX) is still required for interactivity. ## Django for APIs - [Django REST Framework](https://django-rest-framework.org/), the "DRF", funded by O'Reilly, first released in 2011. - [Django Ninja](https://django-ninja.dev/), 2020, inspired by [[fastapi|FastAPI]]. - With Django Ninja, instead of using function return annotations, the return type should be placed in the decorator `response` argument -- since the return value will be transformed by the response schema.