在apache2 下部署django 出现问题(使用conda虚拟环境)

发布于 2022-09-05 08:27:42 字数 3122 浏览 31 评论 0

使用python3, conf 如下

<VirtualHost *:5060>
    ServerName localhost:5060
    ServerAdmin Ysdd1@163.com

    # WSGIPythonPath /home/yangtz/anaconda3/lib/python3.6/site-packages
    WSGIDaemonProcess 192.168.100.18 python-path=/data2/serverend/dpsplat python-home=/home/yangtz/anaconda3/envs/keshihua/lib/python3.6/site-packages
    WSGIProcessGroup 192.168.100.18
    WSGIScriptAlias / /data2/serverend/dpsplat/visualplat/wsgi.py



    <Directory /data2/serverend/dpsplat/visualplat>
    <Files wsgi.py>
        Require all granted
    </Files>
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error-dpsplat.log
    CustomLog ${APACHE_LOG_DIR}/access-dpsplat.log combined

</VirtualHost>

django项目所需的环境在conda的虚拟环境中,命名为keshihua
mod_wsgi.so 已经load了,确认是python3的

apache2正常启动,但是链接没反应,错误日志如下:

[Wed Aug 02 13:31:51.550060 2017] [wsgi:error] [pid 27945:tid 140279756412672] [remote 192.168.100.20:43891] mod_wsgi (pid=27945): Target WSGI script '/data2/serverend/dpsplat/visualplat/wsgi.py' cannot be loaded as Python module.
[Wed Aug 02 13:31:51.550132 2017] [wsgi:error] [pid 27945:tid 140279756412672] [remote 192.168.100.20:43891] mod_wsgi (pid=27945): Exception occurred processing WSGI script '/data2/serverend/dpsplat/visualplat/wsgi.py'.
[Wed Aug 02 13:31:51.550799 2017] [wsgi:error] [pid 27945:tid 140279756412672] [remote 192.168.100.20:43891] Traceback (most recent call last):
[Wed Aug 02 13:31:51.550837 2017] [wsgi:error] [pid 27945:tid 140279756412672] [remote 192.168.100.20:43891]   File "/data2/serverend/dpsplat/visualplat/wsgi.py", line 13, in <module>
[Wed Aug 02 13:31:51.550844 2017] [wsgi:error] [pid 27945:tid 140279756412672] [remote 192.168.100.20:43891]     from django.core.wsgi import get_wsgi_application
[Wed Aug 02 13:31:51.550867 2017] [wsgi:error] [pid 27945:tid 140279756412672] [remote 192.168.100.20:43891] ImportError: No module named 'django'
[Wed Aug 02 13:31:52.549949 2017] [wsgi:error] [pid 27945:tid 140279638914816] [remote 192.168.100.20:43379] mod_wsgi (pid=27945): Target WSGI script '/data2/serverend/dpsplat/visualplat/wsgi.py' cannot be loaded as Python module.
[Wed Aug 02 13:31:52.550040 2017] [wsgi:error] [pid 27945:tid 140279638914816] [remote 192.168.100.20:43379] mod_wsgi (pid=27945): Exception occurred processing WSGI script '/data2/serverend/dpsplat/visualplat/wsgi.py'.
[Wed Aug 02 13:31:52.550199 2017] [wsgi:error] [pid 27945:tid 140279638914816] [remote 192.168.100.20:43379] Traceback (most recent call last):
[Wed Aug 02 13:31:52.550243 2017] [wsgi:error] [pid 27945:tid 140279638914816] [remote 192.168.100.20:43379]   File "/data2/serverend/dpsplat/visualplat/wsgi.py", line 13, in <module>
[Wed Aug 02 13:31:52.550252 2017] [wsgi:error] [pid 27945:tid 140279638914816] [remote 192.168.100.20:43379]     from django.core.wsgi import get_wsgi_application
[Wed Aug 02 13:31:52.550285 2017] [wsgi:error] [pid 27945:tid 140279638914816] [remote 192.168.100.20:43379] ImportError: No module named 'django'

这是怎么回事?我明明在conf里指定conda 环境了啊!!!

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

日裸衫吸 2022-09-12 08:27:43
在服务器运行一下python看看是不是在adconda下
如果是则import django看看
如果不是,则需要软链python到你的adconda下的python
梦毁影碎の 2022-09-12 08:27:43

ImportError: No module named 'django'问题不是很明显么?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文