Reputation: 3743
I am using ubuntu 12.04 and I did the following:
sudo apt-get install python-mysql
sudo python setup.py install (install Django 1.6.2)
sudo apt-get install mysql-server-...
sudo apt-get install apache2
sudo apt-get install libapache2-mod-wsgi
Here are my configuration files:
/home/firstweb.wsgi:
import os
import sys
sys.path = ['/var/www/firstweb'] + sys.path
os.environ['DJANGO_SETTINGS_MODULE'] = 'firstweb.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
/etc/apache/sites-availables/firstweb.conf:
<VirtualHost *:80>
WSGIScriptAlias / /home/adel/firstweb.wsgi
ServerName firstweb.com
Alias /static /var/www/firstweb/static/
<Directory /var/www/firstweb/>
order allow,deny
Allow from all
</Directory>
</VirtualHost>
then I did:
a2ensite firstweb.conf
cd /var/www/
django-admin.py startproject firstweb
apachectl restart
vi /etc/hosts
and add the following (192.168.0.123
is my wlan ip)
192.168.0.123 firstweb.com
I use mysql and I create a database and change the settings.py
and the syncdb
works fine
But when I enter the www.firstweb.com in browser the default page of Apache appears (it works....)
and the Django default page does not appear!!
what is wrong with my configuration?
thank you.
Upvotes: 1
Views: 560
Reputation: 58563
The path your WSGIScriptAlisa directive is referring to, is not within any directory you specified to the Directory directive indicating where Apache was allowed to serve files/scripts from. Further, the Apache user would not normally be able to access files under a user home directory. Both problems would cause different Forbidden HTTP responses. So, even you solve your ServerName/ServerAlias and host issues, you would likely then have those problems. make sure you go read the official mod_wsgi deployment docs on the Django site.
Upvotes: 0
Reputation: 599926
Your virtual server is not listening on www.firstweb.com, only on firstweb.com. You should add a ServerAlias directive for the www version.
Upvotes: 1