Django

Django Apache Setup

Django Apache Setup

Django applications can also be served using Apache with the help of mod_wsgi. The first step you have to do is to install Apache server and mod_wsgi on your system. We already created a wsgi.py file in our previous sections. Let’s have a look at the profile structure:

firstproject/
    manage.py
    firstproject/
    __init__.py
    setttings.py
    urls.py
    wsgi.py

The file will create a link between Apache and Django. It is noticed that the Apache server doesn’t handle Django app. And to solve this, we will have to configure Apache in http.conf as follows:

WSGIScriptAlias / /var/www/html/firstproject/firstproject/wsgi.py
WSGIPythonPath /var/www/html/firstproject/
<Directory /var/www/html/firstproject/>
    <Files wsgi.py>
    Order deny, allow
    Allow from all
    </Files>
</Directory> 

After configuring these settings, you can access the login page by using the URL below:

http://127.0.0.1/firstapp/connection/ 

Top course recommendations for you

    Leap year program in Python
    1 hrs
    Beginner
    1.9K+ Learners
    4.63  (48)
    Prime Number in Java
    2 hrs
    Beginner
    2.3K+ Learners
    4.51  (45)
    Exception and File Handling with Python
    2 hrs
    Intermediate
    3.9K+ Learners
    4.37  (107)
    Heap Data Structure
    1 hrs
    Beginner
    1.7K+ Learners
    4.29  (75)
    Prime Number Program in Python
    1 hrs
    Beginner
    1.9K+ Learners
    4.39  (61)
    Python Uses
    1 hrs
    Beginner
    4.2K+ Learners
    4.25  (154)
    Scope of Software Engineering
    1 hrs
    Beginner
    1.5K+ Learners
    4.44  (117)
    R Studio Basics
    1 hrs
    Beginner
    4.1K+ Learners
    4.48  (145)
    Class in java
    1 hrs
    Beginner
    6.2K+ Learners
    4.47  (189)
    Multithreading In Java
    2 hrs
    Intermediate
    4.7K+ Learners
    4.36  (148)