我正在尝试在运行 Ubuntu 20.04 的非托管 VPS 上运行 django。我连接到新安装的服务器,安装了 Django 和 Postresql。Apache 已经安装。然后我安装了 mod_wsgi。然后我尝试配置我的 .conf 文件。编辑后的文件
etc\apache2\sites-available\000-default.conf
包括以下内容:
Alias /static /root/django-apps/dmsemapping/staticfiles
<Directory /root/django-apps/dmsemapping/staticfiles>
Require all granted
</Directory>
<Directory /root/django-apps/dmsemapping/dmsemapping>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess dmsemapping python-path=/root/django-apps/dmsemapping python-home=/root/django-apps/env
WSGIProcessGroup dmsemapping
WSGIScriptAlias / /root/django-apps/dmsemapping/dmsemapping/wsgi.py
Run Code Online (Sandbox Code Playgroud)
dmsemapping是我的 django 项目的名称
/root/django-apps/dmsemapping是我的项目的路径
/root/django-apps/env是我的 python 环境变量的路径
当我运行这个程序时,我收到 403 错误。在 error.log 文件中我得到:
Current thread 0x00007f84dde19c40 (most recent call first):
<no Python frame>
[Tue Oct 26 22:55:44.887129 2021] [wsgi:warn] [pid 12089:tid 140208634960960] (13)Permission denied: mod_wsgi …Run Code Online (Sandbox Code Playgroud)