Django Apache和基于名称的虚拟主机

yc0p9oo0  于 2022-12-19  发布在  Apache
关注(0)|答案(1)|浏览(136)

我最近在Apache服务器Fedora 36上本地部署了Django项目。通过IP访问站点时一切正常。无法通过主机名访问它的问题。我收到了“Bad Request(400)”错误。
这是我httpd.conf

<VirtualHost *:80>
        ServerName calljournal.local
        alias /static /var/www/django_project/call_journal/static
        <Directory /var/www/django_project/call_journal/static>
                Require all granted
        </Directory>
        <Directory /var/www/django_project/call_journal>
                Require all granted
        </Directory>
        WSGIDaemonProcess calljournal.local python-path=/var/www/django_project/virt/lib/python3.8/site-packages
        WSGIProcessGroup calljournal.local
        WSGIScriptAlias / /var/www/django_project/call_journal/call_journal/wsgi.py
        redirect / https://192.168.1.109
</VirtualHost>

和我的主机文件

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.109 calljournal.local
rqqzpn5f

rqqzpn5f1#

您需要在ALLOWED_HOSTS设置中输入主机名。

相关问题