|
|
|
|
@ -6,11 +6,18 @@ It exposes the WSGI callable as a module-level variable named ``application``.
|
|
|
|
|
For more information on this file, see
|
|
|
|
|
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
# 导入系统模块:用于设置环境变量
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
# 导入 Django WSGI 核心函数:生成符合 WSGI 标准的应用对象
|
|
|
|
|
from django.core.wsgi import get_wsgi_application
|
|
|
|
|
|
|
|
|
|
# 设置 Django 项目的配置模块环境变量
|
|
|
|
|
# 作用:告诉 Django 启动时加载哪个配置文件(此处为项目根目录下的 djangoblog.settings)
|
|
|
|
|
# 部署时可通过修改该值切换配置(如 djangoblog.settings.production 对应生产环境配置)
|
|
|
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djangoblog.settings")
|
|
|
|
|
|
|
|
|
|
application = get_wsgi_application()
|
|
|
|
|
# 生成 WSGI 应用对象
|
|
|
|
|
# 作用:将 Django 项目包装为 WSGI 兼容的应用,供 WSGI 服务器(如 Gunicorn、uWSGI)调用
|
|
|
|
|
# 该对象是 Django 与 Web 服务器交互的核心入口
|
|
|
|
|
application = get_wsgi_application()
|