title: Deploying Django on Apache and WSGI
body: <p>Although I have found a bunch of tech support to deploy Django over Apache using WSGI but infact they all have confused me unfortunately, and I couldn't get the Django running. I hope this to be real easy job but being a new comer I am facing difficulties.</p>
  
  <p>I have two Django projects namely website1 and website2 inside my <em>/home/zia/Documents/Codes/Django/website1</em> and <em>..../website2</em> dir, respectively. The folder containing settings.py file is <em>root/</em> inside the <em>/website1</em> and <em>/website2</em> dir.</p>
  
  <p>Apache, mod_wsgi everything is installed as required. How to edit apache2.conf and wsgi.py file to keep these two projects running over port 8080 and 8081?</p>
  
  <p>I am struggling with this issue for past few days and have tried all the following websites.</p>
  
  <p><a href="https://www.youtube.com/watch?v=hBMVVruB9Vs" rel="nofollow">link1</a>,<a href="http://singlas.in/5-step-tutorial-for-using-django-with-apache-and-mod_wsgi/" rel="nofollow">link2</a>,<a href="https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/modwsgi/" rel="nofollow">link3</a>,<a href="https://www.digitalocean.com/community/tutorials/how-to-run-django-with-mod_wsgi-and-apache-with-a-virtualenv-python-environment-on-a-debian-vps" rel="nofollow">link4</a></p>
  
  <hr>
  
  <p>UPDATE1:</p>
  
  <p>I have followed the following approach right from the beginning to make things going well but found myself in some new issues. Kindly guide me where I am wrong.</p>
  
  <ol>
  <li>Installing mod-wsgi and apache2:
  <code>sudo apt-get install libapache2-mod-wsgi &amp;&amp; sudo apt-get update &amp;&amp; sudo apt-get install apache2</code></li>
  <li>Edit the apache2 port to 8083, instead of 80 by altering file "/etc/apache2/ports.conf": <code>Listen 8083</code></li>
  <li>Add the following line into "/etc/hosts" file: <code>160.75.133.175 160.75.133.175</code></li>
  <li>Edit the following code in the "/etc/apache2/apache2.conf" file: </li>
  </ol>
  
  <p><code>&lt;Directory /&gt;
          Options Indexes FollowSymLinks
          AllowOverride None
          Require all granted
  &lt;/Directory&gt;</code></p>
  
  <ol start="5">
  <li>Create a file inside "/etc/apache2/sites-available/" dir with name "sql_api.conf":</li>
  </ol>
  
  <p><code>&lt;VirtualHost *:8083&gt;
      ServerAdmin zia@gmail.com
      ServerName  160.75.133.175
      ServerAlias http://160.75.133.175
      &lt;Directory /home/zia/Documents/Codes/Django/sql_api/ &gt;
              Order deny,allow
              Allow from all
      &lt;/Directory&gt;
      WSGIScriptAlias / /home/zia/Documents/Codes/Django/sql_api/root/wsgi.py
      WSGIDaemonProcess  160.75.133.175 user=www-data group=www-data threads=25 python-path=/home/zia/Documents/Codes/Django/sql_api/root/:/usr
      WSGIProcessGroup 160.75.133.175
      ErrorLog /home/zia/Documents/Codes/Django/sql_api/root/error.log
  &lt;/VirtualHost&gt;</code></p>
  
  <ol start="6">
  <li>Run the following commands being in "/etc/apache2/sites-available" dir: <code>sudo a2enmod wsgi &amp;&amp; sudo a2ensite sql_api.conf &amp;&amp; sudo service apache2 restart</code></li>
  <li>Open <code>http://160.75.133.175:8083/</code> but getting the following error:
  <em>Internal Server Error
  The server encountered an internal error or misconfiguration and was unable to complete your request.
  Please contact the server administrator at zia@gmail.com to inform them of the time this error occurred, and the actions you performed just before this error.
  More information about this error may be available in the server error log.
  Apache/2.4.7 (Ubuntu) Server at 160.75.133.175 Port 8082</em></li>
  </ol>
  
  <p><strong>NOTE</strong>: When I am making a Django project in <em>/var/www/</em> dir and then doing the same approach then working just fine! I think because I am trying to access <em>/home/zia/....</em> dir, there is this issue. Anyways, this is just a guess. I would appreciate your help.</p>