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 3 weeks ago

if you have any problem comment here

Create Apache Configuration for Your Django wsgi Project

2025-06-07 03:59:24.874882+00:00

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

2025-06-07 03:59:24.874882+00:00

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

2025-06-07 03:59:24.874882+00:00

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

2025-06-07 03:59:24.874882+00:00

Read More
How to Use Django collectstatic the Right Way

2025-06-07 03:59:24.874882+00:00

Read More