unable to deploy Django on ubuntu with apache mod WSGI
NickName:Adel Ask DateTime:2014-03-08T23:18:48

unable to deploy Django on ubuntu with apache mod WSGI

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.

Copyright Notice:Content Author:「Adel」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/22271104/unable-to-deploy-django-on-ubuntu-with-apache-mod-wsgi

Answers
Daniel Roseman 2014-03-08T15:37:02

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


More about “unable to deploy Django on ubuntu with apache mod WSGI” related questions

Unable to deploy django with mod_wsgi & apache

I'm unable to deploy my django site using mod_wsgi after a a few frustrating days of trying. Could someone sanity check these details and see if there's anything obviously wrong? This is my first D...

Show Detail

unable to deploy Django on ubuntu with apache mod WSGI

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 a...

Show Detail

Deploy Django 1.7 on Apache with mod_wsgi

I am a newbie in Django, trying to deploy an app into Apache 2.2 using mod_wsgi. I have a mymapsite created in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs. Inside mymapsite, ...

Show Detail

Cannot deploy Official Django tutorial on Apache (mod_wsgi)

I know this question seems to have been asked and answered many times, but I have now wasted over 48 hours now trying various methods provided by other answers and I cannot seem to deploy the offic...

Show Detail

Deploy two Django projects on one Xampp Windows Apache Mod_WSGI server

I want to deploy multiple Django projects on one server. It is Windows 32 bit Xampp. mod_wsgi is 32 bit. python is 32 bit. Django is ver 1.7.3. I have read lots of posts and tried many things but ...

Show Detail

Can I deploy both python 2 and 3 django app with apache using mod_wsgi?

I am running on ubuntu 14.04. And I am wondering can I deploy my django apps coded with python 2 and 3 together with apache and mod_wsgi? and how?

Show Detail

Can I deploy both python 2 and 3 django app with apache using mod_wsgi?

I am running on ubuntu 14.04. And I am wondering can I deploy my django apps coded with python 2 and 3 together with apache and mod_wsgi? and how?

Show Detail

Django mod_wsgi Apache error 403 Forbidden on Ubuntu 22.04

Django mod_wsgi on Apache application works fine in Ubuntu 20.04 and previous versions with the configuration mentioned below, but when I do the same configuration in Ubuntu 22.04 it gets 403 Forbi...

Show Detail

How to deploy Django App on Ubuntu using Apache2 and mod-wsgi-pytho3

I am trying to deploy my Django App on AWS by following this article Link of the article. I have done almost same but getting this error [Sun Nov 13 16:02:45.432532 2022] [wsgi:error] [pid 116628:tid

Show Detail

Deploy django using apache, mod-wsgi

I'm trying to deploy django using wsgi. But its not working. Will you please help me ? thank you django.wsgi.py #!/usr/bin/python import os, sys sys.path.append('/home/me/project') os.environ['

Show Detail