gpt4 book ai didi

python - Django 和 Python + uWSGI

转载 作者:太空狗 更新时间:2023-10-29 21:57:33 27 4
gpt4 key购买 nike

使用 instruction我尝试连接 Python + uWSGI

我在文件夹 /home/sanya/django/pasteurl 中创建了默认项目。但是,在我得到的浏览器中打开它

uWSGI Error
wsgi application not found

日志包含以下内容:

binding on TCP port: 9001
your server socket listen backlog is limited to 64 connections
added /home/sanya/django/pasteurl to pythonpath.
initializing hooks...done.
...getting the applications list from the 'django' module...
uwsgi.applications dictionary is not defined, trying with the "applications" one...
applications dictionary is not defined, trying with the "application" callable.
static applications not defined, you have to use the dynamic one...
spawned uWSGI master process (pid: 7637)
spawned uWSGI worker 1 (pid: 7646)
spawned uWSGI worker 2 (pid: 7647)
spawned uWSGI worker 3 (pid: 7648)
spawned uWSGI worker 4 (pid: 7649)

文件/home/sanya/django/pasteurl/django.wsgi

import os
import django.core.handlers.wsgi

# init django settings
os.environ['DJANGO_SETTINGS_MODULE'] = 'pasteurl.settings'

# define wsgi app
application = django.core.handlers.wsgi.WSGIHandler()

# mount this application at the webroot
# applications = { '/': 'application' }

我意识到,这个应用程序字典有问题

最佳答案

FWIW,查看 source code ,从第 1997 行开始,我们看到如果 uWSGI 找不到 applications 字典,它会发出您收到的错误消息的确切序列。

查看您的 django.wsgi 文件,我们看到这一行,

`applications = {'/': 'application'} 

被注释掉了。我想知道我们能做些什么 ;)

顺便说一句,我使用 google 找到了源代码.谷歌搜索引号中的错误消息通常是一件好事。在我点击该链接并意识到我很幸运能够直接从谷歌找到源代码(发生越来越多)后,我按下 Ctrl-F 键“在页面上查找”并在我的浏览器中重新输入错误消息在页面搜索工具上,这让我直接找到了相关的行。

关于python - Django 和 Python + uWSGI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3775755/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com