简体   繁体   English

在 Apache2 上部署时出现 Django 未指定错误

[英]Django unspecified error when deploying on Apache2

Below is the error when I try deploy Django==3.2.12, wagtail==2.16.1, python 3.8.2, mod_wsgi 4.9 on a Debian 11 server.以下是我在 Debian 11 服务器上尝试部署 Django==3.2.12, wagtail==2.16.1, python 3.8.2, mod_wsgi 4.9 时出现的错误。 I have a full stack trace at the end.最后我有一个完整的堆栈跟踪。

class SimpleLazyObject(LazyObject):
TypeError: Error when calling the metaclass bases
'property' object is not callable

When I run this on my local dev machine which is a Mac it works just fine.当我在我的本地开发机器(Mac)上运行它时,它工作得很好。 I found someone with the exact same problem but no clarity about how it was resolved.发现有人有完全相同的问题,但不清楚它是如何解决的。

The resources I have been using to assist are 1 , 2 , 3 , 4 .我一直用来协助的资源是1234 I have tried installing mod_wsgi using pip and as well as from sources.我尝试使用 pip 以及源代码安装 mod_wsgi。 Used various guides for Apache2 config.使用 Apache2 配置的各种指南。 Upgraded from python 3.8 to 3.9 as well as downgraded to 3.7.从 python 3.8 升级到 3.9 以及降级到 3.7。

Create interpreter '0.0.0.0|'.
[Tue Mar 29 11:49:06.679710 2022] [wsgi:info] [pid 199764:tid 139683953432320] mod_wsgi (pid=199764): Adding '/var/www/html/portal' to path.
[Tue Mar 29 11:49:06.680057 2022] [wsgi:info] [pid 199764:tid 139683953432320] mod_wsgi (pid=199764): Adding  '/var/www/html/portal/portalvenv/lib/python3.8/site-packages' to path.
[Tue Mar 29 11:49:06.689628 2022] [wsgi:info] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy] mod_wsgi (pid=199764, process='saida-befree_portal', application='0.0.0.0|'): Loading Python script file '/var/www/html/portal/portal/wsgi.py'.
[Tue Mar 29 11:49:06.705081 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy] mod_wsgi (pid=199764): Failed to exec Python script file '/var/www/html/portal/portal/wsgi.py'.
[Tue Mar 29 11:49:06.713633 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy] mod_wsgi (pid=199764): Exception occurred processing WSGI script '/var/www/html/portal/portal/wsgi.py'.
[Tue Mar 29 11:49:06.713903 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy] Traceback (most recent call last):
[Tue Mar 29 11:49:06.714017 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy]   File "/var/www/html/portal/portal/wsgi.py", line 12, in <module>
[Tue Mar 29 11:49:06.714210 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy]     from django.core.wsgi import get_wsgi_application
[Tue Mar 29 11:49:06.714304 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy]   File "/var/www/html/portal/portalvenv/lib/python3.8/site-packages/django/__init__.py", line 1, in <module>
[Tue Mar 29 11:49:06.717663 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy]     from django.utils.version import get_version
[Tue Mar 29 11:49:06.717837 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy]   File "/var/www/html/portal/portalvenv/lib/python3.8/site-packages/django/utils/version.py", line 7, in <module>
[Tue Mar 29 11:49:06.718002 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy]     from django.utils.regex_helper import _lazy_re_compile
[Tue Mar 29 11:49:06.718072 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy]   File "/var/www/html/portal/portalvenv/lib/python3.8/site-packages/django/utils/regex_helper.py", line 10, in <module>
[Tue Mar 29 11:49:06.718305 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy]     from django.utils.functional import SimpleLazyObject
[Tue Mar 29 11:49:06.720700 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy]   File "/var/www/html/portal/portalvenv/lib/python3.8/site-packages/django/utils/functional.py", line 362, in <module>
[Tue Mar 29 11:49:06.721066 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy]     class SimpleLazyObject(LazyObject):
[Tue Mar 29 11:49:06.721539 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy] TypeError: Error when calling the metaclass bases
[Tue Mar 29 11:49:06.721610 2022] [wsgi:error] [pid 199764:tid 139683953432320] [remote xx.xx.xx.xxx:yyyy]     'property' object is not callable
[Tue Mar 29 11:49:58.057546 2022] [reqtimeout:info] [pid 199765:tid 139683870795520] [client xx.xx.xx.xxx:yyyy] AH01382: Request header read timeout

I had the same issue so i did the following steps:我有同样的问题,所以我做了以下步骤:

Remove the apache2 library by using the following command- sudo apt-get remove python-pip apache2 libapache2-mod-wsgi使用以下命令删除 apache2 库 - sudo apt-get remove python-pip apache2 libapache2-mod-wsgi

Then use the following command to install the correct library- sudo apt-get install python3-pip apache2 libapache2-mod-wsgi-py3然后使用以下命令安装正确的库 - sudo apt-get install python3-pip apache2 libapache2-mod-wsgi-py3

This solved my error.这解决了我的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM