You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tentest/doc/DjangoBlog/djangoblog/wsgi.py

26 lines
1.2 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

"""
WSGI config for djangoblog project.
WSGI配置文件用于djangoblog项目
It exposes the WSGI callable as a module-level variable named ``application``.
该文件将WSGI可调用对象暴露为模块级别的变量`application`供Web服务器如Nginx、Gunicorn调用
For more information on this file, see
关于此文件的更多信息,请参考:
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
#wr 导入os模块用于处理操作系统环境变量
import os
#wr 从Django核心WSGI模块导入获取WSGI应用的函数
#wr get_wsgi_application()会返回Django项目的WSGI兼容应用实例
from django.core.wsgi import get_wsgi_application
#wr 设置Django使用的配置模块环境变量
#wr "DJANGO_SETTINGS_MODULE"是Django约定的环境变量用于指定项目配置文件路径
#wr 这里设置为"djangoblog.settings"即项目根目录下的settings.py文件
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djangoblog.settings")
#wr 获取WSGI应用实例并赋值给application变量
#wr Web服务器如Gunicorn会通过这个变量与Django应用进行交互处理HTTP请求
application = get_wsgi_application()