How can I tell whether my Django application is running on development server or not?

后端 未结 13 1549
别跟我提以往
别跟我提以往 2020-12-05 03:37

How can I be certain that my application is running on development server or not? I suppose I could check value of settings.DEBUG and assume if DEBUG

13条回答
  •  醉梦人生
    2020-12-05 04:21

    You can determine whether you're running under WSGI (mod_wsgi, gunicorn, waitress, etc.) vs. manage.py (runserver, test, migrate, etc.) or anything else:

    import sys
    WSGI = 'django.core.wsgi' in sys.modules
    

提交回复
热议问题