Django生产报错500,看不到报错
Error 500 in Django production, can't see the error
我正在使用 django 和 wsgi。
当我 运行 使用 DEBUG = True 或 False 的命令 运行 服务器时,一切都很好但是当我为 运行 我的应用程序创建守护程序时,我在 apache 的日志中得到了 500 错误的页面我收到错误 500,但即使 DEBUG 为 True 我也看不到错误,我认为这是 apache(2.4.41) 和 wsgi 的问题
这是创建守护进程的配置文件
Alias /static /home/(user)/(domain)/static
<ifmodule mod_wsgi.c>
WSGIDaemonProcess ic user=(user) group=(user) processes=1 threads=2 python-path=/home/(user)/(domain):/home/(user)/.venv/ic
</ifmodule>
WSGIProcessGroup ic
WSGIApplicationGroup ic
WSGIScriptAlias / /home/(user)/(domain)/ic/wsgi.py
WSGIPassAuthorization on
<Directory /home/(user)/(domain)/ic/>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
LogLevel debug
Errorlog /var/log/apache2/domlogs/(domain)_error
CustomLog /var/log/apache2/domlogs/(domain)_custom combined
在错误日志中显示这个(已创建 venv)
[Sat Jan 11 10:24:54.138254 2020] [ssl:debug] [pid 9308:tid 47752169862912] ssl_util_stapling.c(874): AH01956: stapling_cb: setting response
[Sat Jan 11 10:24:54.316201 2020] [ssl:debug] [pid 9308:tid 47752169862912] ssl_engine_kernel.c(383): [client xxx.xxx.xxx.xxx:23440] AH02034: Initial (No.1) HTTPS request received for child 0 (server (url):443)
[Sat Jan 11 10:24:54.316509 2020] [authz_core:debug] [pid 9308:tid 47752169862912] mod_authz_core.c(820): [client xxx.xxx.xxx.xxx:23440] AH01626: authorization result of Require all granted: granted
[Sat Jan 11 10:24:54.316520 2020] [authz_core:debug] [pid 9308:tid 47752169862912] mod_authz_core.c(820): [client xxx.xxx.xxx.xxx:23440] AH01626: authorization result of <RequireAny>: granted
[Sat Jan 11 10:24:54.317397 2020] [authz_core:debug] [pid 9308:tid 47752169862912] mod_authz_core.c(820): [client xxx.xxx.xxx.xxx:23440] AH01626: authorization result of Require all granted: granted
[Sat Jan 11 10:24:54.317408 2020] [authz_core:debug] [pid 9308:tid 47752169862912] mod_authz_core.c(820): [client xxx.xxx.xxx.xxx:23440] AH01626: authorization result of <RequireAny>: granted
[Sat Jan 11 10:24:54.328015 2020] [wsgi:info] [pid 9302:tid 47752171964160] mod_wsgi (pid=9302): Create interpreter 'ic'.
[Sat Jan 11 10:24:54.341454 2020] [wsgi:info] [pid 9302:tid 47752171964160] mod_wsgi (pid=9302): Adding '/home/(user)/(domain)' to path.
[Sat Jan 11 10:24:54.341632 2020] [wsgi:info] [pid 9302:tid 47752171964160] mod_wsgi (pid=9302): Adding '/home/(user)/.venv/ic' to path.
wsgi.py 文件
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ic.settings')
application = get_wsgi_application()
"Help me, Whosebug. You're my only hope."
最后我看了另一个错误日志,我的问题在 virtualenv
我正在使用 django 和 wsgi。
当我 运行 使用 DEBUG = True 或 False 的命令 运行 服务器时,一切都很好但是当我为 运行 我的应用程序创建守护程序时,我在 apache 的日志中得到了 500 错误的页面我收到错误 500,但即使 DEBUG 为 True 我也看不到错误,我认为这是 apache(2.4.41) 和 wsgi 的问题
这是创建守护进程的配置文件
Alias /static /home/(user)/(domain)/static
<ifmodule mod_wsgi.c>
WSGIDaemonProcess ic user=(user) group=(user) processes=1 threads=2 python-path=/home/(user)/(domain):/home/(user)/.venv/ic
</ifmodule>
WSGIProcessGroup ic
WSGIApplicationGroup ic
WSGIScriptAlias / /home/(user)/(domain)/ic/wsgi.py
WSGIPassAuthorization on
<Directory /home/(user)/(domain)/ic/>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
LogLevel debug
Errorlog /var/log/apache2/domlogs/(domain)_error
CustomLog /var/log/apache2/domlogs/(domain)_custom combined
在错误日志中显示这个(已创建 venv)
[Sat Jan 11 10:24:54.138254 2020] [ssl:debug] [pid 9308:tid 47752169862912] ssl_util_stapling.c(874): AH01956: stapling_cb: setting response
[Sat Jan 11 10:24:54.316201 2020] [ssl:debug] [pid 9308:tid 47752169862912] ssl_engine_kernel.c(383): [client xxx.xxx.xxx.xxx:23440] AH02034: Initial (No.1) HTTPS request received for child 0 (server (url):443)
[Sat Jan 11 10:24:54.316509 2020] [authz_core:debug] [pid 9308:tid 47752169862912] mod_authz_core.c(820): [client xxx.xxx.xxx.xxx:23440] AH01626: authorization result of Require all granted: granted
[Sat Jan 11 10:24:54.316520 2020] [authz_core:debug] [pid 9308:tid 47752169862912] mod_authz_core.c(820): [client xxx.xxx.xxx.xxx:23440] AH01626: authorization result of <RequireAny>: granted
[Sat Jan 11 10:24:54.317397 2020] [authz_core:debug] [pid 9308:tid 47752169862912] mod_authz_core.c(820): [client xxx.xxx.xxx.xxx:23440] AH01626: authorization result of Require all granted: granted
[Sat Jan 11 10:24:54.317408 2020] [authz_core:debug] [pid 9308:tid 47752169862912] mod_authz_core.c(820): [client xxx.xxx.xxx.xxx:23440] AH01626: authorization result of <RequireAny>: granted
[Sat Jan 11 10:24:54.328015 2020] [wsgi:info] [pid 9302:tid 47752171964160] mod_wsgi (pid=9302): Create interpreter 'ic'.
[Sat Jan 11 10:24:54.341454 2020] [wsgi:info] [pid 9302:tid 47752171964160] mod_wsgi (pid=9302): Adding '/home/(user)/(domain)' to path.
[Sat Jan 11 10:24:54.341632 2020] [wsgi:info] [pid 9302:tid 47752171964160] mod_wsgi (pid=9302): Adding '/home/(user)/.venv/ic' to path.
wsgi.py 文件
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ic.settings')
application = get_wsgi_application()
"Help me, Whosebug. You're my only hope."
最后我看了另一个错误日志,我的问题在 virtualenv