Home > Mobile >  Django Apache and name-based VirtualHost
Django Apache and name-based VirtualHost

Time:12-17

I have recently locally deployed Django project on Apache server Fedora 36. Everything work good when accessing site by ip. The issue that could not access it by hostname. I am getting "Bad Request (400)" error.

here my 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>

and my hosts file

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

CodePudding user response:

You need to enter the hostname in ALLOWED_HOSTS settings.

  • Related