Django Configuration with Apache Web Server

Django uses its built-in development server to run the web application. To start this server, we can use python manage.py runserver command.

This command starts the server which runs on port 8000 and can be accessed at browser by entering localhost:8000. It shows a welcome page of the application.

django configuration with apache web server

And at browser, it can be accessed as below.

django configuration with apache web server 1

But if we want to run our application by using apache server rather than built-in development server, we need to configure apache2.conf file located at /etc/apache directory. Add the following code into this file.

// apache2.conf

After adding these lines, restart apache server by using the service apache2 restart command and then type localhost to the browser's address bar. This time, project will run on apache server rather than a built-in server. See, it shows the home page of the application.

django configuration with apache web server 2




Latest Courses