部署 Django 应用程序:禁止访问您无权访问此资源

Deploying Django app : Forbidden You don't have permission to access this resource

我正在使用 apache 网络服务器在我的 VPS 上部署我的 django 应用程序。 它在 http://192.46.209.82:8000/ 上工作得很好,但是当我尝试使用我的 IP 地址 192.46.209.82 访问它时。我得到

Forbidden
You don't have permission to access this resource.

Apache/2.4.41 (Ubuntu) Server at 192.46.209.82 Port 80

这是我的配置文件

nano /etc/apache2/sites-available/000-default.conf

<VirtualHost *:80>
        ServerAdmin webmaster@example.com
        DocumentRoot /root/django/myproject
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        Alias /static /root/django/myproject/static
        <Directory /root/django/myproject/static>
                Require all granted
        </Directory>
        <Directory /root/django/myproject/myproject>
                <Files wsgi.py>
                        Require all granted
                </Files>
        </Directory>
        WSGIDaemonProcess myproject python-path=/root/django/myproject python-home=/root/django/myprojectenv
        WSGIProcessGroup myproject
        WSGIScriptAlias / /root/django/myproject/myproject/wsgi.py
</VirtualHost>

我使用的是python的虚拟环境,myprojectenv是我的虚拟环境路径,密码是/root/django

注意:我尝试了这个问题的答案,作为对这个问题的建议,但这对我不起作用。

编辑:更新权限

在我的例子中,即使我正确设置了所有权限,我仍然遇到错误,所以我将我的整个项目和虚拟环境移动到 /opt,它现在对我有用。但是我想知道为什么即使我给了所有权限

它也不能在/home下工作