Apache2&Django - NameError:未定义名称"AttributeError"



我遵循了几乎所有的官方文档,让我的Django项目在我的Ubuntu 18.04 v-server上运行。它似乎奏效了。。。sudo服务apache2状态->一切都很好。

[Sun May 03 16:07:20.489608 2020] [mpm_event:notice] [pid 11531:tid 139884218760128] AH00489: 
Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1 mod_wsgi/4.7.1 Python/3.8 configured -- resuming normal operations
[Sun May 03 16:07:20.489764 2020] [core:notice] [pid 11531:tid 139884218760128] AH00094:
Command line: '/usr/sbin/apache2'

我第一次注意到,当我的模板在没有服务器重启的情况下无法更新时,就会出现问题,这不是Django的常见行为(即使在生产环境中也是如此(。每当我重新启动服务器时,我都会在apache2/error.log中收到这个错误。虽然服务器一直在工作,但我想弄清真相。

Exception ignored in: <function Local.__del__ at 0x7fbd983f03a0>
Traceback (most recent call last):
File "/var/www/my_app/.my_app/lib/python3.8/site-packages/asgiref/local.py", line 95, in __del__
NameError: name 'AttributeError' is not defined
Exception ignored in: <function Local.__del__ at 0x7fbd983f03a0>
Traceback (most recent call last):
File "/var/www/my_app/.my_app/lib/python3.8/site-packages/asgiref/local.py", line 95, in __del__
NameError: name 'AttributeError' is not defined
[Sun May 03 16:07:19.418926 2020] [core:warn] [pid 11433:tid 140452536064960] AH00045: child process 11435 still did not exit, sending a SIGTERM
[Sun May 03 16:07:20.419208 2020] [mpm_event:notice] [pid 11433:tid 140452536064960] AH00491: caught SIGTERM, shutting down
[Sun May 03 16:07:20.489608 2020] [mpm_event:notice] [pid 11531:tid 139884218760128] AH00489: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1 mod_wsgi/4.7.1 Python/3.8 configured -- resuming normal operations
[Sun May 03 16:07:20.489764 2020] [core:notice] [pid 11531:tid 139884218760128] AH00094: Command line: '/usr/sbin/apache2'
  • Ubuntu 18.04
  • Python3.8.0,并通过更新备选方案链接到python命令
  • Python在venv中运行

项目结构:

in /var/www/:
|-- my_app
|   |-- my_app
|   |   |-- __init__.py
|   |   |-- asgi.py
|   |   |-- settings.py
|   |   |-- urls.py
|   |   `-- wsgi.py
|   |-- db.sqlite3
|   |-- manage.py
|   |-- media
|   |-- .my_app (python venv)
|   |-- my_subapp
|   |   |-- __init__.py
|   |   |-- admin.py
|   |   |-- apps.py
|   |   |-- migrations
|   |   |-- models.py
|   |   |-- tests.py
|   |   |-- urls.py
|   |   `-- views.py
|   `-- templates
|       |-- base.html
|       `-- index.html

当它似乎是一个开箱即用的标准python类时,有什么可能出错的建议吗?为什么它会说"AttributeError not found?"。。。感谢您的帮助:-(

我花了一天时间才发现问题所在-感谢mod_wsgi的创建者Graham Dumpleton解释了一切。你可以在这里查找:

https://github.com/GrahamDumpleton/mod_wsgi/issues/568

相关内容

  • 没有找到相关文章

最新更新