1

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:

  1. a2ensite firstweb.conf
  2. cd /var/www/
  3. django-admin.py startproject firstweb
  4. apachectl restart
  5. 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.

2 Answers 2

1

Your virtual server is not listening on www.firstweb.com, only on firstweb.com. You should add a ServerAlias directive for the www version.

Sign up to request clarification or add additional context in comments.

4 Comments

Add this to your apache config file: ServerAlias www.firstweb.com
thank you knapo but what config file? I have httpd.conf and http.conf in my /etc/apache2 and both of them are blank. is there any other configuration file? where is my apache2 config file??
Add it to the conf file you've shown above, next to where you specify the ServerName.
Hello Daniel I did that and the problem still remains!
0

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.