Целевой скрипт WSGI не может быть загружен как модуль Python: нет модуля с именем 'pytz' - PullRequest
0 голосов
/ 05 ноября 2019

Эта ошибка кажется довольно простой, чтобы решить, верно? Я попытался сделать pip3 установить pytz. Но он все еще думает, что его там нет. Любые идеи?

Для контекста я следую этому руководству https://mindchasers.com/dev/apache-install

А вот мой error.log:

[Tue Nov 05 16:36:26.413502 2019] [wsgi:error] [pid 23202:tid 140594089387776]   mod_wsgi (pid=23202): Target WSGI script '/build/CommsApp/CommsApp/wsgi.py' cannot be loaded as Python module.
[Tue Nov 05 16:36:26.413537 2019] [wsgi:error] [pid 23202:tid 140594089387776]   mod_wsgi (pid=23202): Exception occurred processing WSGI script '/build/CommsApp/CommsApp/wsgi.py'.
[Tue Nov 05 16:36:26.413732 2019] [wsgi:error] [pid 23202:tid 140594089387776]   Traceback (most recent call last):
[Tue Nov 05 16:36:26.413800 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/CommsApp/CommsApp/wsgi.py", line 12, in <module>
[Tue Nov 05 16:36:26.413805 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.core.wsgi import get_wsgi_application
[Tue Nov 05 16:36:26.413811 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/core/wsgi.py", line 2, in <module>
[Tue Nov 05 16:36:26.413815 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.core.handlers.wsgi import WSGIHandler
[Tue Nov 05 16:36:26.413820 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/core/handlers/wsgi.py", line 8, in <module>
[Tue Nov 05 16:36:26.413824 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.core.handlers import base
[Tue Nov 05 16:36:26.413830 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/core/handlers/base.py", line 8, in <module>
[Tue Nov 05 16:36:26.413833 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.urls import get_resolver, set_urlconf
[Tue Nov 05 16:36:26.413839 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/urls/__init__.py", line 1, in <module>
[Tue Nov 05 16:36:26.413842 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from .base import (
[Tue Nov 05 16:36:26.413848 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/urls/base.py", line 8, in <module>
[Tue Nov 05 16:36:26.413851 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from .exceptions import NoReverseMatch, Resolver404
[Tue Nov 05 16:36:26.413857 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/urls/exceptions.py", line 1, in <module>
[Tue Nov 05 16:36:26.413861 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.http import Http404
[Tue Nov 05 16:36:26.413866 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/http/__init__.py", line 5, in <module>
[Tue Nov 05 16:36:26.413869 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.http.response import (
[Tue Nov 05 16:36:26.413884 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/http/response.py", line 15, in <module>
[Tue Nov 05 16:36:26.413889 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.core.serializers.json import DjangoJSONEncoder
[Tue Nov 05 16:36:26.413894 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/core/serializers/__init__.py", line 23, in <module>
[Tue Nov 05 16:36:26.413898 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.core.serializers.base import SerializerDoesNotExist
[Tue Nov 05 16:36:26.413903 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/core/serializers/base.py", line 7, in <module>
[Tue Nov 05 16:36:26.413907 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.db import models
[Tue Nov 05 16:36:26.413912 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/db/models/__init__.py", line 3, in <module>
[Tue Nov 05 16:36:26.413916 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.db.models.aggregates import *  # NOQA
[Tue Nov 05 16:36:26.413921 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/db/models/aggregates.py", line 5, in <module>
[Tue Nov 05 16:36:26.413925 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.db.models.expressions import Case, Func, Star, When
[Tue Nov 05 16:36:26.413930 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/db/models/expressions.py", line 8, in <module>
[Tue Nov 05 16:36:26.413934 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.db.models import fields
[Tue Nov 05 16:36:26.413939 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/db/models/fields/__init__.py", line 11, in <module>
[Tue Nov 05 16:36:26.413942 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django import forms
[Tue Nov 05 16:36:26.413948 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/forms/__init__.py", line 6, in <module>
[Tue Nov 05 16:36:26.413951 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.forms.boundfield import *  # NOQA
[Tue Nov 05 16:36:26.413957 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/forms/boundfield.py", line 3, in <module>
[Tue Nov 05 16:36:26.413960 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.forms.utils import flatatt, pretty_name
[Tue Nov 05 16:36:26.413966 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/forms/utils.py", line 6, in <module>
[Tue Nov 05 16:36:26.413969 2019] [wsgi:error] [pid 23202:tid 140594089387776]       from django.utils import timezone
[Tue Nov 05 16:36:26.413975 2019] [wsgi:error] [pid 23202:tid 140594089387776]     File "/build/django/django/utils/timezone.py", line 11, in <module>
[Tue Nov 05 16:36:26.413978 2019] [wsgi:error] [pid 23202:tid 140594089387776]       import pytz
[Tue Nov 05 16:36:26.413992 2019] [wsgi:error] [pid 23202:tid 140594089387776]   ModuleNotFoundError: No module named 'pytz'

1 Ответ

0 голосов
/ 05 ноября 2019

Нашел решение!

Я использовал sudo su и запустил команду установки pip3 от имени пользователя root, и это, похоже, помогло!

...