django.core.wsgi import get_wsgi_application,无模块django

发布于 2025-01-22 14:18:52 字数 1308 浏览 2 评论 0原文

ve一直在努力部署我的django应用程序时,当我使用0.0.0.0.0:8000进行操作时,一切正常,但是一旦我使用apache,我就会从django.core.wsgi import import get_wsgi_application获得django,没有名为django的模块。

我尝试将我的Python版本更改为Ubuntu 18.04,以及对于Python3.6.9的3.9.12,我在两个版本上都会遇到相同的错误。当我进行pip冻结时,我正在安装venv和django,我还尝试直接在WSGI中添加路径,但同样的错误,我的IVE也加倍检查我的conf文件,因为这不应该是问题,因为我从我的其他Django应用程序中复制和调整,这里没有任何问题,

这是

Alias /static /home/YOURUSER/YOURPROJECT/static
  <Directory /home/YOURUSER/YOURPROJECT/static>
    Require all granted
  </Directory>

  Alias /media /home/YOURUSER/YOURPROJECT/media
  <Directory /home/YOURUSER/YOURPROJECT/media>
    Require all granted
  </Directory>

  <Directory /home/YOURUSER/YOURPROJECT/YOURPROJECT>
    <Files wsgi.py>
      Require all granted
    </Files>
  </Directory>

  WSGIScriptAlias / /home/YOURUSER/YOURPROJECT/YOURPROJECT/wsgi.py
  WSGIDaemonProcess django_app python-path=/home/YOURUSER/YOURPROJECT python-home=/home/YOURUSER/YOURPROJECT/venv
  WSGIProcessGroup django_app

我还尝试了一些我读过的有关我们

sudo apt-apt-get remove libapache2-mod-python libapache2-mod-wsgi sudo apt-get安装libapache2-mod-wsgi-py3

但这也没有做任何事情,所以我似乎无法解决此错误,也没有在我的env Python packages django django中安装在我的VENV中。

感谢任何帮助。

ve been struggling with deploying my Django app, when i do it with 0.0.0.0:8000 everything works fine but as soon as i am using apache then i get Django from django.core.wsgi import get_wsgi_application , No module named Django.

Ive tried changing my python version on Ubuntu 18.04 as well for Python3.6.9 to the 3.9.12 and i get the same error on both versions . i am running it in a VENV as well as Django is installed when i do a pip freeze, ive also tried adding paths in my WSGI directly but same error , my also ive doubled check my conf file as that should not be the problem since i copied and adjusted from my other django app that is running with no problems

here is the code

Alias /static /home/YOURUSER/YOURPROJECT/static
  <Directory /home/YOURUSER/YOURPROJECT/static>
    Require all granted
  </Directory>

  Alias /media /home/YOURUSER/YOURPROJECT/media
  <Directory /home/YOURUSER/YOURPROJECT/media>
    Require all granted
  </Directory>

  <Directory /home/YOURUSER/YOURPROJECT/YOURPROJECT>
    <Files wsgi.py>
      Require all granted
    </Files>
  </Directory>

  WSGIScriptAlias / /home/YOURUSER/YOURPROJECT/YOURPROJECT/wsgi.py
  WSGIDaemonProcess django_app python-path=/home/YOURUSER/YOURPROJECT python-home=/home/YOURUSER/YOURPROJECT/venv
  WSGIProcessGroup django_app

Also ive tried some examples that i read about such us

sudo apt-get remove libapache2-mod-python libapache2-mod-wsgi
sudo apt-get install libapache2-mod-wsgi-py3

but that also did not do anything so i can't seem to get around this error and also in my env python packages Django is there so it is installed in my venv.

i would appreciate any help thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文