Create Apache Configuration for Your Django wsgi Project

bmpokhrel9 | May 25, 2025


Create Apache Configuration for Your Django wsgi Project

Create a new Apache config file:

sudo nano /etc/apache2/sites-available/yourproject.conf

 

Example configuration:

<VirtualHost *:80>
   ServerName yourdomain.com
   ServerAdmin [email protected]
   Alias /static /path/to/your/project/static
   <Directory /path/to/your/project/static>
       Require all granted
   </Directory>
   <Directory /path/to/your/project/yourproject>
       <Files wsgi.py>
           Require all granted
       </Files>
   </Directory>
   WSGIDaemonProcess yourproject python-path=/path/to/your/project python-home=/path/to/your/project/venv
   WSGIProcessGroup yourproject
   WSGIScriptAlias / /path/to/your/project/yourproject/wsgi.py
</VirtualHost>

Replace /path/to/your/project with the absolute path to your Django project folder.

 

 

Enable Your Site and Restart Apache

sudo a2ensite yourproject.conf
sudo a2dissite 000-default.conf  # Optional: disable default site
sudo systemctl restart apache2




1 COMMENTS:

bmpokhrel9 1 week ago

if you have any problem comment here

Create Apache Configuration for Your Django wsgi Project

Create a new Apache config file:sudo nano /etc/apache2/sites-available/yourproject.conf &nbsp;Examp

Read More
How to Create a Django App – Step by Step Guide

How to Create a Django App – Step by Step Guide&nbsp;&nbsp;Django is a powerful and popular Python-b

Read More
Understanding Python Files in a Django App – Full Guide for Beginners

Understanding Python Files in a Django App – Full Guide for BeginnersDjango is a high-level Python w

Read More
Understanding Django Settings: The Backbone of Your Web App Configuration

&nbsp;Understanding Django Settings: The Backbone of Your Web App Configuration&nbsp;&nbsp;When you'

Read More
How to Use Django collectstatic the Right Way

&nbsp;&nbsp;🚀 How to Use Django collectstatic the Right WayWhen deploying a Django project to produc

Read More