gpt4 book ai didi

python - 服务器上的 django 应用程序 : apache runs with python 2. 7 而不是 python 3.5

转载 作者:行者123 更新时间:2023-12-04 19:13:25 24 4
gpt4 key购买 nike

我的 ubuntu 服务器上有一个 Django 应用程序。到目前为止,我使用的是 python 2.7。

我的 Django 版本是 1.11.6。

从现在开始,我想使用 python 3.5。但是当我运行 sudo service apache2 restart我收到包含 python 2.7 的错误:

[Mon Oct 23 12:40:53.500064 2017] [wsgi:error] [pid 28615] [client 194.42.16.145:23434] mod_wsgi (pid=28615): Target WSGI script '/home/zinonas/guardianangel/GuardianAngel/wsgi.py' cannot be loaded as Python module.
[Mon Oct 23 12:40:53.500102 2017] [wsgi:error] [pid 28615] [client 194.42.16.145:23434] mod_wsgi (pid=28615): Exception occurred processing WSGI script '/home/zinonas/guardianangel/GuardianAngel/wsgi.py'.
[Mon Oct 23 12:40:53.500125 2017] [wsgi:error] [pid 28615] [client 194.42.16.145:23434] Traceback (most recent call last):
[Mon Oct 23 12:40:53.500144 2017] [wsgi:error] [pid 28615] [client 194.42.16.145:23434] File "/home/zinonas/guardianangel/GuardianAngel/wsgi.py", line 15, in <module>
[Mon Oct 23 12:40:53.500203 2017] [wsgi:error] [pid 28615] [client 194.42.16.145:23434] application = get_wsgi_application()
[Mon Oct 23 12:40:53.500213 2017] [wsgi:error] [pid 28615] [client 194.42.16.145:23434] File "/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 13, in get_wsgi_application
[Mon Oct 23 12:40:53.500240 2017] [wsgi:error] [pid 28615] [client 194.42.16.145:23434] django.setup(set_prefix=False)
[Mon Oct 23 12:40:53.500250 2017] [wsgi:error] [pid 28615] [client 194.42.16.145:23434] File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 22, in setup
[Mon Oct 23 12:40:53.500281 2017] [wsgi:error] [pid 28615] [client 194.42.16.145:23434] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Mon Oct 23 12:40:53.500308 2017] [wsgi:error] [pid 28615] [client 194.42.16.145:23434] File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 56, in __getattr__
[Mon Oct 23 12:40:53.500371 2017] [wsgi:error] [pid 28615] [client 194.42.16.145:23434] self._setup(name)
[Mon Oct 23 12:40:53.500381 2017] [wsgi:error] [pid 28615] [client 194.42.16.145:23434] File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 41, in _setup
[Mon Oct 23 12:40:53.500393 2017] [wsgi:error] [pid 28615] [client 194.42.16.145:23434] self._wrapped = Settings(settings_module)
[Mon Oct 23 12:40:53.500398 2017] [wsgi:error] [pid 28615] [client 194.42.16.145:23434] File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 110, in __init__
[Mon Oct 23 12:40:53.500406 2017] [wsgi:error] [pid 28615] [client 194.42.16.145:23434] mod = importlib.import_module(self.SETTINGS_MODULE)
[Mon Oct 23 12:40:53.500411 2017] [wsgi:error] [pid 28615] [client 194.42.16.145:23434] File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
[Mon Oct 23 12:40:53.500443 2017] [wsgi:error] [pid 28615] [client 194.42.16.145:23434] __import__(name)
[Mon Oct 23 12:40:53.500466 2017] [wsgi:error] [pid 28615] [client 194.42.16.145:23434] ImportError: No module named settings.mysql

你知道如何解决这个问题吗?

最佳答案

也许你安装了用于 python 2 的 libapache2-mod-wsgi 包。

对于 python 3,您需要安装 libapache2-mod-wsgi-py3,然后 apache 将使用 python3。

关于python - 服务器上的 django 应用程序 : apache runs with python 2. 7 而不是 python 3.5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46889709/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com