So here's my apache config:
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so
<VirtualHost *:80>
ServerAdmin marijus.merkevicius@gmail.com
ServerName 31.220.49.197
WSGIDaemonProcess ts threads=25
WSGIProcessGroup ts
Alias /static /home/email-validator/static
WSGIScriptAlias / /home/email-validator/index.wsgi
# Set access permission
<Directory />
Allow from all
Require all granted
</Directory>
</VirtualHost>
Here's my index.wsgi:
import os
import sys
import site
# Add the app's directory to the PYTHONPATH
sys.path.append('/home/email-validator')
sys.path.append('/home/email-validator/email_validator')
os.environ['DJANGO_SETTINGS_MODULE'] = 'email_validator.settings'
os.environ['PYTHON_EGG_CACHE'] = '/tmp'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
EDIT:
apache error.log
[Sat Nov 15 12:28:09.374301 2014] [mpm_event:notice] [pid 3827:tid 3074431616] AH00489: Apache/2.4.7 (Ubuntu) mod_wsgi/3.4 Python/2.7.6 configured -- resuming normal operations
[Sat Nov 15 12:28:09.374426 2014] [core:notice] [pid 3827:tid 3074431616] AH00094: Command line: '/usr/sbin/apache2'
[Sat Nov 15 12:32:45.009711 2014] [mpm_event:notice] [pid 3827:tid 3074431616] AH00491: caught SIGTERM, shutting down
[Sat Nov 15 12:32:46.137115 2014] [so:warn] [pid 4297:tid 3074935424] AH01574: module wsgi_module is already loaded, skipping
[Sat Nov 15 12:32:46.142088 2014] [mpm_event:notice] [pid 4298:tid 3074935424] AH00489: Apache/2.4.7 (Ubuntu) mod_wsgi/3.4 Python/2.7.6 configured -- resuming normal operations
[Sat Nov 15 12:32:46.142125 2014] [core:notice] [pid 4298:tid 3074935424] AH00094: Command line: '/usr/sbin/apache2'
[Sat Nov 15 12:42:04.023659 2014] [mpm_event:notice] [pid 4298:tid 3074935424] AH00491: caught SIGTERM, shutting down
[Sat Nov 15 12:42:04.248193 2014] [so:warn] [pid 4409:tid 3074857600] AH01574: module wsgi_module is already loaded, skipping
[Sat Nov 15 12:42:04.252825 2014] [mpm_event:notice] [pid 4410:tid 3074857600] AH00489: Apache/2.4.7 (Ubuntu) mod_wsgi/3.4 Python/2.7.6 configured -- resuming normal operations
[Sat Nov 15 12:42:04.252860 2014] [core:notice] [pid 4410:tid 3074857600] AH00094: Command line: '/usr/sbin/apache2'
ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:127.0.0.2 P-t-P:127.0.0.2 Bcast:0.0.0.0 Mask:255.255.255.255
inet6 addr: 2a02:4780:1:1::1:1f88/128 Scope:Global
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
RX packets:20113 errors:0 dropped:0 overruns:0 frame:0
TX packets:9810 errors:0 dropped:3 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:23659654 (23.6 MB) TX bytes:917246 (917.2 KB)
venet0:0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.224.2.128 P-t-P:10.224.2.128 Bcast:10.224.2.128 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
When I go to http://31.220.49.197
apache doesn't serve me django app. When I do service apache2 restart
everything goes okay What am I doing wrong ? This configuration works on my other applications.
Best Answer
I was facing same problem but fortunately after digging into the apache settings I was able to resolve this.
Here is my apache configure file i.e 000-default.conf which serves default page instead of my app. Note*: Examples are being shown below with the help of OP apache configuration.
And after commenting out default virtualhost setting at port 80 resolves my problem though we are still getting same error logs :) .
that means commenting out or removing entire default/first
<VirtualHost *:80>
section will resolve problem.I am currently having Ubuntu 14.4 and this problem aroused after upgrading from 12.4.