Apache Django 内部服务器错误 (Ubuntu 18.04)

时间:2021-01-18 23:47:45

标签: django apache ubuntu-18.04 mod-wsgi wagtail

我有一个 Django wagtail 应用程序。我可以在调试中运行它,也可以在 django 服务器上运行它,但是如果我尝试使用 Apache2 WSGI 在我的 Ubuntu 18.04 服务器上运行它,我会收到“内部服务器错误”。阿帕奇日志:

[Mon Jan 18 23:29:23.673557 2021] [mpm_event:notice] [pid 92324:tid 140613127453760] AH00491: caught SIGTERM, shutting down
Exception ignored in: <function BaseEventLoop.__del__ at 0x7fe301c1fc10>
Traceback (most recent call last):
  File "/usr/lib/python3.8/asyncio/base_events.py", line 654, in __del__
NameError: name 'ResourceWarning' is not defined
Exception ignored in: <function Local.__del__ at 0x7fe301b95040>
Traceback (most recent call last):
  File "/home/user/wow/lib/python3.8/site-packages/asgiref/local.py", line 96, in __del__
NameError: name 'TypeError' is not defined
Exception ignored in: <function Local.__del__ at 0x7fe301b95040>
Traceback (most recent call last):
  File "/home/user/wow/lib/python3.8/site-packages/asgiref/local.py", line 96, in __del__
NameError: name 'TypeError' is not defined
Exception ignored in: <function Local.__del__ at 0x7fe301b95040>
Traceback (most recent call last):
  File "/home/user/wow/lib/python3.8/site-packages/asgiref/local.py", line 96, in __del__
NameError: name 'TypeError' is not defined
[Mon Jan 18 23:29:24.194636 2021] [mpm_event:notice] [pid 92749:tid 139932982541376] AH00489: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f mod_wsgi/4.6.8 Python/3.8 configured -- resuming normal operations
[Mon Jan 18 23:29:24.194764 2021] [core:notice] [pid 92749:tid 139932982541376] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jan 18 23:29:31.468972 2021] [wsgi:error] [pid 92750:tid 139932932445952] WSGI without exception

我的 wsgi 文件:

import os
import time
import traceback
import signal
import sys
from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "americanss.settings.production")

application = get_wsgi_application()

try:
    application = get_wsgi_application()
    print('WSGI without exception')
except Exception:
    print('handing WSGI exception')
    # Error loading applications
    if 'mod_wsgi' in sys.modules:
        traceback.print_exc()
        os.kill(os.getpid(), signal.SIGINT)
        time.sleep(2.5)

从我发现的情况来看,引发的异常发生了,似乎没有人知道为什么,但大多数情况下它不会阻止应用程序运行。就我而言,我收到了 500 错误,我无法判断这是否与回溯有关,因为没有其他人报告 500 与这些错误。

apactctl -M:

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 143.110.226.199. Set the 'ServerName' directive globally to suppress this message
Loaded Modules:
 core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 unixd_module (static)
 access_compat_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 filter_module (shared)
 mime_module (shared)
 mpm_event_module (shared)
 negotiation_module (shared)
 reqtimeout_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 socache_shmcb_module (shared)
 ssl_module (shared)
 status_module (shared)
 wsgi_module (shared)

0 个答案:

没有答案
相关问题