WSGI:Django App未获得所需的site-packages

2024-05-29 06:03:20 发布

您现在位置:Python中文网/ 问答频道 /正文

不幸的是我的网站返回了500个错误。在

apache日志不是很具体,所以我真的不知道该怎么做。在升级之前一切都很好。在

我认为这可能是一个权限错误。如何设置使用WSGI的权限?在

或者你知道为什么这个问题会因为另一个原因发生吗?在

apache配置:

...
WSGIDaemonProcess aegee-stuttgart.org  python-path=/home/sysadmin/public_html/aegee-stuttgart.org:/home/sysadmin/.virtualenvs/django/lib/python2.7
    WSGIProcessGroup aegee-stuttgart.org
    WSGIScriptAlias / /home/sysadmin/public_html/aegee-stuttgart.org/aegee/wsgi.py
...

在wsgi.py公司名称:

^{pr2}$

在错误.log公司名称:

mod_wsgi (pid=23202): Exception occurred processing WSGI script '/home/sysadmin/p$
Traceback (most recent call last):
 File "/home/sysadmin/public_html/aegee-stuttgart.org/aegee/wsgi.py", line 31, i$
   return super(WSGIEnvironment, self).__call__(environ, start_response)
 File "/usr/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 189,$
   response = self.get_response(request)
 File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 218,$
   response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
 File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 264,$
   if resolver.urlconf_module is None:
 File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 395, $
   self._urlconf_module = import_module(self.urlconf_name)
 File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
   __import__(name)
 File "/home/sysadmin/public_html/aegee-stuttgart.org/aegee/urls.py", line 8, in$
   from .userprofile.views import AccountPersonalInfoView
 File "/home/sysadmin/public_html/aegee-stuttgart.org/aegee/userprofile/views.py$
   from django.contrib.auth.mixins import LoginRequiredMixin
ImportError: No module named mixins

Tags: djangopyorgselfwsgihomelibusr
1条回答
网友
1楼 · 发布于 2024-05-29 06:03:20

使用:

WSGIDaemonProcess aegee-stuttgart.org python-home=/home/sysadmin/.virtualenvs/django python-path=/home/sysadmin/public_html/aegee-stuttgart.org

不是你所拥有的。可以使用python-path来引用虚拟环境,但使用的目录不正确。使用python-home,并将其设置为sys.prefix为虚拟环境提供的相同目录。在

因为您使用了错误的目录,所以它是从主Python安装中获取Django,而不是从虚拟环境中获取Django。在

相关问题 更多 >

    热门问题