pythondjangowsgidjango-2.0django-3.0

What is the use of wsgi.py file that is there in django application when created using django-admin startproject


Can anyone help me in understanding what is the use of wsgi.py file?

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings.local")

application = get_wsgi_application()

Solution

  • This file is basically used for deployment only as is not used in development, except when you are using docker.

    It is used as an interface between application server to connect with django or any python framework which implements wsgi specified by python community, taking about usage mostly you will see it is used with gunicorn