小编Sid*_*hik的帖子

Django mod_wsgi Apache 服务器,ModuleNotFoundError:没有名为 Django 的模块

我读了很多文章,但仍然不知道我错过了什么。我正在从 virtualenv 运行一个 django 网站。这是我的配置文件。网站地址已替换为<domain.com>,此处无法使用。

配置

<VirtualHost *:80>
    
        ServerAdmin sidharth@collaboration-management
        ServerName <domain.com>
        ServerAlias <domain.com>
        DocumentRoot /home/sidharth/Downloads/gmcweb

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

        Alias /static /home/sidharth/Downloads/gmcweb/static

        <Directory /home/sidharth/Downloads/gmcweb/static>
                Require all granted
        </Directory>

        <Directory /home/sidharth/Downloads/gmcweb/gmcweb>
                <Files wsgi.py>
                        Require all granted
                </Files>
        </Directory>


        WSGIDaemonProcess gmcweb python-home=/home/sidharth/Downloads/gmcwebenvlin python-path=/home/sidharth/Downloads/gmcweb
        WSGIProcessGroup gmcweb
        WSGIScriptAlias / /home/sidharth/Downloads/gmcweb/gmcweb/wsgi.py
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

这是我的 WSGI.py 文件,没有更改任何以前不需要的内容

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'gmcweb.settings')

application = get_wsgi_application()
Run Code Online (Sandbox Code Playgroud)

Python 版本

我的 virtualenv python 版本是 3.9.5 默认 Google VM python 版本是 3.6.9

Python 安装的库

Package                  Version …
Run Code Online (Sandbox Code Playgroud)

python apache django mod-wsgi

5
推荐指数
1
解决办法
6054
查看次数

标签 统计

apache ×1

django ×1

mod-wsgi ×1

python ×1