Report this

What is the reason for this report?

How to configure Apache server with Django for deployment on Virtual Machine

Posted on April 30, 2020

im currently trying to deploy my django project to a web server hosted by a RHEL-8 VM. Im trying to set up the VM to utilize HTTPD (apache). However, i can’t seem to get the Virtual Host configuration files right. I am pretty new to django and web servers as this is my first time deploying a web server. As such, i have been trying to do this for quite some time now and nothing online seems to work. As of recently i have tried more or less following this tutorial https://computingforgeeks.com/deploy-python-3-django-application-on-centos-with-apache-and-mod-wsgi/ on getting it deployed. As such, here is the code i have added into /etc/httpd/conf.d/django.conf:

<VirtualHost *:80>
        ServerAdmin info@awesomedjango.com
        ServerName awesomedjango.com
        DocumentRoot /var/www/

        Alias /static /var/www/awesomedjango/static
        <Directory "/var/www/awesomedjango/static">
                Options FollowSymLinks
                Order allow,deny
                Allow from all
                Require all granted
        </Directory>

        ErrorLog /var/www/awesomedjango/logs/apis_error.log
        CustomLog /var/www/awesomedjango/logs/apis_access.log combined

        WSGIPassAuthorization On
        WSGIDaemonProcess awesomedjango python-path=/var/www/awesomedjango:/var/www/awesomedjango/venv/lib/python3.6/site-packages
        WSGIProcessGroup awesomedjango
        WSGIScriptAlias / /var/www/awesomedjango/v/wsgi.py

        <Directory /var/www/awesomedjango/awesomedjango>
                <Files wsgi.py>
                        Require all granted
                </Files>
        </Directory>
</VirtualHost>

But when i try to restart apache to apply this via ‘’’ apachectl restart ‘’', i just receive these errors:

  • httpd.service: Main process exited, code=exited, status=1/FAILURE
  • httpd.service: Failed with result ‘exit-code’.
  • Failed to start The Apache HTTP Server.

Any help would be greatly appreciated as i cant seem to find a solution to my problem online. Thanks

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.