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

问题描述 投票:1回答:1

我几乎遵循了所有官方文档,以使Django项目在Ubuntu 18.04 v服务器上运行。它似乎可以正常工作... sudo service apache2 status->一切都还可以。

[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并通过update-alternatives链接到python-command
  • 在venv中运行的Python

项目结构:

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

[任何建议可能有什么问题,为什么它说“找不到AttributeError?”当它似乎是一个现成的标准python类时,谢谢您的帮助:-)

python django apache ubuntu mod-wsgi
1个回答
0
投票

[我花了一天的时间才找出问题所在,这要归功于Graham Dumpleton-mod_wsgi的创建者解释了所有问题。您可以在这里查找:

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

© www.soinside.com 2019 - 2024. All rights reserved.