繁体   English   中英

django module installed by python pip not found for apache mod wsgi python version

[英]django module installed by python pip not found for apache mod wsgi python version

我的 apache 日志显示

AH00163: Apache/2.4.52 (Ubuntu) OpenSSL/3.0.2 mod_wsgi/4.9.0 Python/3.10 configured

当我开始 python3 repl

Python 3.10.6 (main, Aug 10 2022, 11:40:04) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import django_tgbot
>>> django_tgbot
<module 'django_tgbot' from '/home/admin/.local/lib/python3.10/site-packages/django_tgbot/__init__.py'>

但是mod wsgi启动的python3.10无法加载django中的模块

[Mon Sep 26 20:47:58.471013 2022] [wsgi:error] [pid 294801] [client 62.227.246.99:41236] mod_wsgi (pid=294801): Failed to exec Python script file '/var/www/django/tgweb/tgweb/wsgi.py'.
[Mon Sep 26 20:47:58.471122 2022] [wsgi:error] [pid 294801] [client 62.227.246.99:41236] mod_wsgi (pid=294801): Exception occurred processing WSGI script '/var/www/django/tgweb/tgweb/wsgi.py'.
[Mon Sep 26 20:47:58.473468 2022] [wsgi:error] [pid 294801] [client 62.227.246.99:41236] Traceback (most recent call last):
[Mon Sep 26 20:47:58.473563 2022] [wsgi:error] [pid 294801] [client 62.227.246.99:41236]   File "/var/www/django/tgweb/tgweb/wsgi.py", line 19, in <module>
[Mon Sep 26 20:47:58.473579 2022] [wsgi:error] [pid 294801] [client 62.227.246.99:41236]     application = get_wsgi_application()
[Mon Sep 26 20:47:58.473599 2022] [wsgi:error] [pid 294801] [client 62.227.246.99:41236]   File "/usr/local/lib/python3.10/dist-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Mon Sep 26 20:47:58.473610 2022] [wsgi:error] [pid 294801] [client 62.227.246.99:41236]     django.setup(set_prefix=False)
[Mon Sep 26 20:47:58.473628 2022] [wsgi:error] [pid 294801] [client 62.227.246.99:41236]   File "/usr/local/lib/python3.10/dist-packages/django/__init__.py", line 24, in setup
[Mon Sep 26 20:47:58.473639 2022] [wsgi:error] [pid 294801] [client 62.227.246.99:41236]     apps.populate(settings.INSTALLED_APPS)
[Mon Sep 26 20:47:58.473656 2022] [wsgi:error] [pid 294801] [client 62.227.246.99:41236]   File "/usr/local/lib/python3.10/dist-packages/django/apps/registry.py", line 91, in populate
[Mon Sep 26 20:47:58.473667 2022] [wsgi:error] [pid 294801] [client 62.227.246.99:41236]     app_config = AppConfig.create(entry)
[Mon Sep 26 20:47:58.473683 2022] [wsgi:error] [pid 294801] [client 62.227.246.99:41236]   File "/usr/local/lib/python3.10/dist-packages/django/apps/config.py", line 193, in create
[Mon Sep 26 20:47:58.473704 2022] [wsgi:error] [pid 294801] [client 62.227.246.99:41236]     import_module(entry)
[Mon Sep 26 20:47:58.473722 2022] [wsgi:error] [pid 294801] [client 62.227.246.99:41236]   File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
[Mon Sep 26 20:47:58.473733 2022] [wsgi:error] [pid 294801] [client 62.227.246.99:41236]     return _bootstrap._gcd_import(name[level:], package, level)
[Mon Sep 26 20:47:58.473749 2022] [wsgi:error] [pid 294801] [client 62.227.246.99:41236]   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
[Mon Sep 26 20:47:58.473766 2022] [wsgi:error] [pid 294801] [client 62.227.246.99:41236]   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
[Mon Sep 26 20:47:58.473783 2022] [wsgi:error] [pid 294801] [client 62.227.246.99:41236]   File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
[Mon Sep 26 20:47:58.473817 2022] [wsgi:error] [pid 294801] [client 62.227.246.99:41236] ModuleNotFoundError: No module named 'django_tgbot'
[Mon Sep 26 20:48:01.121519 2022] [reqtimeout:info] [pid 294541] [client 62.227.246.99:34122] AH01382: Request header read timeout

也许这是 django 问题?

暂无
暂无

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

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