django项目几个主要文件

经过网上查询和自己思考,把django项目主要几个文件写出来

1.wsgi.py

官网解释:

 

When the WSGI server loads your application, Django needs to import the settings module — that’s where your entire application is defined.

Django uses the DJANGO_SETTINGS_MODULE environment variable to locate the appropriate settings module. It must contain the dotted path to the settings module. You can use a different value for development and production; it all depends on how you organize your settings.

If this variable isn’t set, the default wsgi.py sets it to mysite.settings, where mysite is the name of your project. That’s how runserver discovers the default settings file by default.

 

When the WSGI server loads your application, Django needs to import the settings module — that’s where your entire application is defined.

Django uses the DJANGO_SETTINGS_MODULE environment variable to locate the appropriate settings module. It must contain the dotted path to the settings module. You can use a different value for development and production; it all depends on how you organize your settings.

If this variable isn’t set, the default wsgi.py sets it to mysite.settings, where mysite is the name of your project. That’s how runserver discovers the default settings file by default.


翻译:

 

使用WSGI进行部署的关键概念是application应用程序服务器用于与您的代码进行通信的可调用代码。它通常作为一个application在服务器可访问的Python模块中命名的对象提供。

startproject命令创建一个<project_name>/wsgi.py包含这种application可调用的文件 。

它用于Django的开发服务器和生产WSGI部署。

WSGI服务器application从其配置获取可调用的路径。Django的内置服务器,即runserver 命令,从WSGI_APPLICATION设置中读取它。默认情况下,它被设置为<project_name>.wsgi.application,指向application 可调用的<project_name>/wsgi.py

 

当WSGI服务器加载你的应用程序时,Django需要导入设置模块 - 这是你的整个应用程序被定义的地方。

Django使用 DJANGO_SETTINGS_MODULE环境变量来定位适当的设置模块。它必须包含设置模块的虚线路径。您可以使用不同的价值进行开发和生产; 这一切都取决于你如何组织你的设置。

如果未设置此变量,则默认wsgi.py将其设置为 mysite.settings,其中mysite是项目的名称。这是

  • 3
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值