I am having trouble getting apache to serve my site via virtualenv (and virtualenvwrapper). I tried following the walkthrough here. Of note, I am using Ubuntu Server v13.10 which I've read doesn't have native support for Apache v2.2 yet, thus in the walkthrough I was not able to install apache2.2-common. However, I don't think that is the issue as the apache error logs are saying there is a permissions problem.
In my setup the virtual environment lives in a non-root user's home directory, while the apache server runs as root (I think this is normal). I have tried to trace the permissions using namei and I've made sure to chmod +rw to the path as root. Any ideas?
[Thu Mar 06 14:16:37.639031 2014] [mpm_event:notice] [pid 8771:tid 140338386122624] AH00489: Apache/2.4.6 (Ubuntu) mod_wsgi/3.4 Python/2.7.5+ configured -- resuming normal operations
[Thu Mar 06 14:16:37.639144 2014] [core:notice] [pid 8771:tid 140338386122624] AH00094: Command line: '/usr/sbin/apache2'
[Thu Mar 06 14:16:53.456622 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742] mod_wsgi (pid=8775): Target WSGI script '/var/www/www.mysite.org/index.wsgi' cannot be loaded as Python module.
[Thu Mar 06 14:16:53.456735 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742] mod_wsgi (pid=8775): Exception occurred processing WSGI script '/var/www/www.mysite.org/index.wsgi'.
[Thu Mar 06 14:16:53.456782 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742] Traceback (most recent call last):
[Thu Mar 06 14:16:53.456830 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742] File "/var/www/www.mysite.org/index.wsgi", line 16, in <module>
[Thu Mar 06 14:16:53.456918 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742] execfile(activate_env, dict(__file__=activate_env))
[Thu Mar 06 14:16:53.456971 2014] [:error] [pid 8775:tid 140338291197696] [client 192.168.XXX.XXX:50742] IOError: [Errno 13] Permission denied: '/home/nrUser/Envs/mysite/bin/activate_this.py'
(mysite)root:~# namei -m /home/nrUser/Envs/mysite/bin/activate_this.py
f: /home/nrUser/Envs/mysite/bin/activate_this.py
drwxr-xr-x /
drwxr-xr-x home
drw-r--r-- nrUser
drwxrwxr-x Envs
drwxrwxr-x mysite
drwxrwxr-x bin
-rwxrwxr-x activate_this.py
To be able to access the files, the apache owner needs at least the x bits on all directories above your files, and the r bit to the files themselves. Your nrUser directory is missing the x bits; chmod 755 /home/nrUser should fix your problem.
If I remember correctly, Apache user/group needs permissions to read the directories. Try applying chown to your mysite directory, for example:
sudo chown -R <user>:www-data mysite <-- while in nrUser home directory
Restart apache using sudo service apache2 restart and see if you can access your website.
Related
I'm trying to deploy my django application on my remote server, but I'm getting an http 500 internal server error.
Here are the configurations I made:
Structure file
/home/ubuntu/project/env (virtualenv folder)
bin
include
lib
/home/ubuntu/project/
|- manage.py
| - env
| - my_project
/home/ubuntu/project/my_project
|__init__.py
|settings.py
|urls.py
|wsgi.py
Fichier 000-default.conf
<VirtualHost *:80>
WSGIDaemonProcess myproject python-home=/home/ubuntu/project/env python-
path=/home/ubuntu/project/my_project
WSGIProcessGroup myproject
WSGIScriptAlias / /home/ubuntu/project/my_project/wsgi.py
<Directory /home/ubuntu/project/my_project>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
Error log
[Fri Dec 30 11:28:18.988904 2022] [wsgi:error] [pid 31289:tid 140473618372288] [remote
41.82.143.41:50428] File "/home/ubuntu/project/my_project/wsgi.py", line 12, in <module>
[Fri Dec 30 11:28:18.988915 2022] [wsgi:error] [pid 31289:tid 140473618372288] [remote
41.82.143.41:50428] from django.core.wsgi import get_wsgi_application
[Fri Dec 30 11:28:18.988933 2022] [wsgi:error] [pid 31289:tid 140473618372288] [remote
41.82.143.41:50428] ModuleNotFoundError: No module named 'django'
[Fri Dec 30 11:28:19.164861 2022] [wsgi:error] [pid 31289:tid 140473651943104] [remote
41.82.143.41:50427] mod_wsgi (pid=31289): Failed to exec Python script file
'/home/ubuntu/project/my_project/wsgi.py'.
[Fri Dec 30 11:28:19.164958 2022] [wsgi:error] [pid 31289:tid 140473651943104] [remote
41.82.143.41:50427] mod_wsgi (pid=31289): Exception occurred processing WSGI script
'/home/ubuntu/project/my_project/wsgi.py'.
[Fri Dec 30 11:28:19.165130 2022] [wsgi:error] [pid 31289:tid 140473651943104] [remote
41.82.143.41:50427] Traceback (most recent call last):
[Fri Dec 30 11:28:19.165172 2022] [wsgi:error] [pid 31289:tid 140473651943104] [remote
41.82.143.41:50427] File "/home/ubuntu/project/my_project/wsgi.py", line 12, in <module>
[Fri Dec 30 11:28:19.165183 2022] [wsgi:error] [pid 31289:tid 140473651943104] [remote
41.82.143.41:50427] from django.core.wsgi import get_wsgi_application
[Fri Dec 30 11:28:19.165212 2022] [wsgi:error] [pid 31289:tid 140473651943104] [remote
41.82.143.41:50427] ModuleNotFoundError: No module named 'django'
I then used this process : make custom versions of Python and mod_wsgi ourselves.
apt install apache2 apache2-dev
wget https://codeload.github.com/GrahamDumpleton/mod_wsgi/tar.gz/4.9.4
tar xvfz 4.9.4
cd mod_wsgi-4.9.4
./configure --with-python=[your python path]
## For example: ./configure --with-python=/usr/bin/python3.10
sudo make
sudo make install
## Finally:
sudo systemctl reload apache2
I use python 3.10 and apache2
and the error still persists (500 internal server error)
I do not know what to do ???
I found the answer by adding to my wsgi.py file the path where django is installed
I try deploying Django in apache2 with python 3.4, but send error 500.
apache error.log:
[Sat May 13 15:56:53.638802 2017] [mpm_event:notice] [pid 3610:tid 140692947613568] AH00489: Apache/2.4.12 (Ubuntu) mod_wsgi/4.3.0 Python/3.4.3+ configured -- resuming normal operations
[Sat May 13 15:56:53.638897 2017] [core:notice] [pid 3610:tid 140692947613568] AH00094: Command line: '/usr/sbin/apache2'
[Sat May 13 15:56:56.622523 2017] [wsgi:error] [pid 3613:tid 140692834260736] [remote 181.75.140.109:26259] mod_wsgi (pid=3613): Target WSGI script '/var/www/html/reportado-plataforma/reportalo/wsgi.py' cannot be loaded as Python module.
[Sat May 13 15:56:56.622610 2017] [wsgi:error] [pid 3613:tid 140692834260736] [remote 181.75.140.109:26259] mod_wsgi (pid=3613): Exception occurred processing WSGI script '/var/www/html/reportado-plataforma/reportalo/wsgi.py'
[Sat May 13 15:56:56.622646 2017] [wsgi:error] [pid 3613:tid 140692834260736] [remote 181.75.140.109:26259] Traceback (most recent call last):
[Sat May 13 15:56:56.622842 2017] [wsgi:error] [pid 3613:tid 140692834260736] [remote 181.75.140.109:26259] File "/var/www/html/reportado-plataforma/reportalo/wsgi.py", line 12, in <module>
[Sat May 13 15:56:56.622851 2017] [wsgi:error] [pid 3613:tid 140692834260736] [remote 181.75.140.109:26259] from django.core.wsgi import get_wsgi_application
[Sat May 13 15:56:56.622876 2017] [wsgi:error] [pid 3613:tid 140692834260736] [remote 181.75.140.109:26259] ImportError: No module named 'django'
I installed
sudo apt-get install python3-pip apache2 libapache2-mod-wsgi-py3
my VirtualHost:
WSGIScriptAlias / /var/www/html/reportado-plataforma/reportalo/wsgi.py
WSGIDaemonProcess reportalo python-path=/var/www/html/reportado-plataforma:/root/env/lib/python3.4/site-packages
WSGIProcessGroup reportalo
WSGIPassAuthorization On
virtualhost directory:
<Directory /var/www/html/reportado-plataforma/reportalo>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
my environment:
appdirs==1.4.3
Django==1.11.1
django-cors-headers==2.0.2
django-filter==1.0.2
django-geoposition==0.3.0
django-location-field==2.0.3
djangorestframework==3.6.2
djangorestframework-gis==0.11.1
Markdown==2.6.8
olefile==0.44
packaging==16.8
Pillow==4.1.1
psycopg2==2.7.1
pyparsing==2.2.0
pytz==2017.2
six==1.10.0
uWSGI==2.0.15
The user that Apache runs your code as is unlikely to have the ability to see anything under the /root directory. Usually only root can see into that directory. Place your application Python virtual environment somewhere else.
Also read:
http://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html
for the recommended way of setting up a Python virtual environment with mod_wsgi. Use python-home as documented and not python-path.
I'm trying to access a Django application using apache and I'm getting Internal Server Error. I've opened the logs to see what is going on and I found this:
[Thu Jun 23 03:10:03 2016] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Jun 23 03:10:03 2016] [notice] Digest: generating secret for digest authentication ...
[Thu Jun 23 03:10:03 2016] [notice] Digest: done
[Thu Jun 23 03:10:03 2016] [notice] Apache/2.2.15 (Unix) DAV/2 mod_wsgi/3.2 Python/2.6.6 configured -- resuming normal operations
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] mod_wsgi (pid=5612): Target WSGI script '/home/TaskManagement/teamwork/wsgi.py' cannot be loaded as Python module.
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] mod_wsgi (pid=5612): Exception occurred processing WSGI script '/home/TaskManagement/teamwork/wsgi.py'.
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] Traceback (most recent call last):
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] File "/home/TaskManagement/teamwork/wsgi.py", line 15, in <module>
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] from django.core.wsgi import get_wsgi_application
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] File "/home/py3venv/lib/python3.4/site-packages/django/__init__.py", line 1, in <module>
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] from django.utils.version import get_version
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] File "/home/py3venv/lib/python3.4/site-packages/django/utils/version.py", line 7, in <module>
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] from django.utils.lru_cache import lru_cache
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] File "/home/py3venv/lib/python3.4/site-packages/django/utils/lru_cache.py", line 28
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] fasttypes = {int, str, frozenset, type(None)},
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] ^
[Thu Jun 23 03:10:10 2016] [error] [client 197.41.248.175] SyntaxError: invalid syntax
I'm using python 3.4, Django 1.9, apache 2.2.
and here is my apache configuration:
WSGISocketPrefix /var/run/wsgi
WSGIScriptAlias / /home/TaskManagement/teamwork/wsgi.py process-group=hrm.jodod.info
WSGIDaemonProcess hrm.jodod.info python-path=/home/TaskManagement:/home/py3venv/lib/python3.4/site-packages
WSGIProcessGroup hrm.jodod.info
Alias /robots.txt /home/TaskManagement/robots.txt
Alias /favicon.ico /home/TaskManagement/favicon.ico
Alias /static/ /home/TaskManagement/static/
<Directory /path/to/mysite.com/static>
Order deny,allow
Allow from all
</Directory>
<Directory /home/TaskManagement/teamwork>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
and here is my wsgi.py file:
import os
import sys
sys.path.append('/home/TaskManagement')
sys.path.append('/home/TaskManagement/teamwork')
from django.core.wsgi import get_wsgi_application
os.environ["DJANGO_SETTINGS_MODULE"] = "{{ project_name }}.settings"
application = get_wsgi_application()
Can anybody figure out what am I doing wrong?
Python/2.6.6 configured -- resuming normal operations
Looks like your mod_wsgi is compiled against Python 2.6.6 and you're trying to run Python3 code with it. The Set syntax you are seeing in the error appeared in Py3. Recompile mod_wsgi and try again.
Your wsgi.py line 9 has to be
os.environ["DJANGO_SETTINGS_MODULE"] = "teamwork.settings"
if the directory it's stored is called teamwork (your project's name)
also in your manage.py it has to be "teamwork.settings"
In my site2 Django application Apache wsgi don't have writing access for files in /var/www/site2, even if:
I have chown-ed to apache all files from /var/www/site2 directory
I give all rights (chmod -R 777).
and SELinux is disabled.
Below is a briefing state:
[root#nuc www]# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built: Nov 19 2015 21:43:13
[root#nuc www]# ls -l
total 4
drwxr-xr-x. 2 root root 6 Nov 19 23:43 cgi-bin
drwxr-xr-x. 2 root root 6 Apr 2 15:02 html
drwxrwxrwx. 6 apache apache 4096 Apr 3 16:14 site2
[root#nuc site2]# ls -l
...
drwxrwxrwx. 5 apache apache 4096 Apr 2 15:23 blog
-rwxrwxrwx. 1 apache apache 95232 Apr 3 16:09 db.sqlite3
drwxrwxrwx. 5 apache apache 4096 Apr 2 16:54 home
-rwxrwxrwx. 1 apache apache 248 Mar 19 13:56 manage.py
drwxrwxrwx. 5 apache apache 4096 Apr 3 16:13 pock
drwxrwxrwx. 2 apache apache 4096 Apr 3 14:45 site2
[root#nuc www]# sestatus
SELinux status: disabled
httpd.conf ...
#-------------------------------------------------
WSGIScriptAlias / /var/www/site2/site2/wsgi.py
WSGIPythonPath /var/www/site2/
Alias /static/ /var/www/site2/blog/static/
Alias /static2/ /var/www/site2/home/static/
Alias /static3/ /var/www/site2/pock/static/
<Directory /var/www/site2/blog/static/>
Require all granted
</Directory>
<Directory /var/www/site2/home/static/>
Require all granted
</Directory>
<Directory /var/www/site2/pock/static/>
Require all granted
</Directory>
<Directory /var/www/site2/site2/>
<Files wsgi.py>
#Order deny,allow
Allow from all
Require all granted
</Files>
</Directory>
#-------------------------------------------------
And still in /var/log/httpd/error_log:
[Sun Apr 03 13:43:17.389404 2016] [:error] [pid 4753] /var/www/site2
[Sun Apr 03 13:43:17.390560 2016] [:error] [pid 4753] Internal Server Error: /pock/test/
[Sun Apr 03 13:43:17.390593 2016] [:error] [pid 4753] Traceback (most recent call last):
[Sun Apr 03 13:43:17.390602 2016] [:error] [pid 4753] File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 149, in get_response
[Sun Apr 03 13:43:17.390609 2016] [:error] [pid 4753] response = self.process_exception_by_middleware(e, request)
[Sun Apr 03 13:43:17.390634 2016] [:error] [pid 4753] File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 147, in get_response
[Sun Apr 03 13:43:17.390643 2016] [:error] [pid 4753] response = wrapped_callback(request, *callback_args, **callback_kwargs)
[Sun Apr 03 13:43:17.390650 2016] [:error] [pid 4753] File "/var/www/site2/pock/views.py", line 57, in test
[Sun Apr 03 13:43:17.390656 2016] [:error] [pid 4753] f = open('test.txt', 'w')
[Sun Apr 03 13:43:17.390662 2016] [:error] [pid 4753] IOError: [Errno 13] Permission denied: 'test.txt'
SOLVED
Thanks to suggestions of Volodymyr I did more digging and I find the way finnaly.
Moving project in /home directory was not working for me: getting "Forbidden" from Apache.
The file I was trying to write need absolute path:
f = open('/var/www/site2/test.txt', 'w')
Otherwise wsgi python would try to write it in "/" root file system, so the error above is explained
In the end I did chown -R 744 /var/www/site2 and it worked, writing to files and database.
Seems that I have done other error but, anyway, it works now.
Try to :
chown -R root:apache /Path/To/You/WebSitePackage
I had this problem when deploy Django with httpd on Centos 7. I chose other way : Create WEBSITE Package in home/user/ directory, then
chown -R apache:apache Path/To/WEBSITEPackage
chmod -R 770 Path/To/WEBSITEPackage
After You can try :
chown -R user:root Path/To/WEBSITEPackage
chmod -R 770 Path/To/WEBSITEPackage
chown -R apache:root Path/To/WEBSITEPackage
chmod -R 770 Path/To/WEBSITEPackage
Other words apache on centos 7 need root privelegies
I have been trying to deploy my Django application on ubuntu 14.04 with the installed packages which are:
django 1.4.15
apache 2.4
python 2.7
mod_wsgi 3.4 (there is one compiled as mod_wsig.so-2.7 which is the one I use)
on my apache config I have this fields:
# Modules
LoadModule mpm_worker_module /usr/lib/apache2/modules/mod_mpm_worker.so
LoadModule mime_module /usr/lib/apache2/modules/mod_mime.so
LoadModule alias_module /usr/lib/apache2/modules/mod_alias.so
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so-2.7
LoadModule setenvif_module /usr/lib/apache2/modules/mod_setenvif.so
LoadModule authn_core_module /usr/lib/apache2/modules/mod_authn_core.so
LoadModule authz_core_module /usr/lib/apache2/modules/mod_authz_core.so
...
<Directory />
Options FollowSymLinks
AllowOverride None
AuthType none
Require all granted
</Directory>
...
# And finally the app config.
WSGIPythonHome /home/web/.virtualenvs/web
WSGIPythonPath /PATH/TO/MYSITE:/home/web/.virtualenvs/web/lib/python2.7/site-packages
WSGIScriptAlias / "/PATH/TO/wsgi.py"
Everything seems to be fine until I try to import one of the local modules in my system. By this I mean, the wsgi.py script runs no problem and then the django settings.py start running, in the settings I have this code:
from MYSITE.environments.prod_settings import *
environments is a module with it's own __init__.py file and all. but when it reaches that line it can't import.
The other part is that the site runs perfectly when I run ./manage.py runserver and the info in the sys.path is just the same!
I am just out of ideas on why apache wsgi will not let me import that python module.
Here is the latest logs:
[Fri Nov 28 18:07:06.222374 2014] [core:notice] [pid 3639:tid 140258688976768] AH00094: Command line: '/usr/sbin/apache2'
[Fri Nov 28 18:07:09.322057 2014] [:error] [pid 3642:tid 140258619721472] /home/web/.virtualenvs/web <--- printed the sys.prefix
[Fri Nov 28 18:07:09.673877 2014] [:error] [pid 3642:tid 140258619721472] 2014-11-28 18:07:09,670 (3642/MainThread) newrelic ERROR - Falling back to stderr logging as unable to create log file '/var/log/newrelic/newrelic-python-agent.log'.
[Fri Nov 28 18:07:09.673930 2014] [:error] [pid 3642:tid 140258619721472] Traceback (most recent call last):
[Fri Nov 28 18:07:09.673941 2014] [:error] [pid 3642:tid 140258619721472] File "/home/web/.virtualenvs/web/local/lib/python2.7/site-packages/newrelic-2.28.0.26/newrelic/common/log_file.py", line 79, in initialize_logging
[Fri Nov 28 18:07:09.673950 2014] [:error] [pid 3642:tid 140258619721472] _initialize_file_logging(log_file, log_level)
[Fri Nov 28 18:07:09.673959 2014] [:error] [pid 3642:tid 140258619721472] File "/home/web/.virtualenvs/web/local/lib/python2.7/site-packages/newrelic-2.28.0.26/newrelic/common/log_file.py", line 51, in _initialize_file_logging
[Fri Nov 28 18:07:09.673969 2014] [:error] [pid 3642:tid 140258619721472] handler = logging.FileHandler(log_file)
[Fri Nov 28 18:07:09.673977 2014] [:error] [pid 3642:tid 140258619721472] File "/usr/lib/python2.7/logging/__init__.py", line 903, in __init__
[Fri Nov 28 18:07:09.673985 2014] [:error] [pid 3642:tid 140258619721472] StreamHandler.__init__(self, self._open())
[Fri Nov 28 18:07:09.673993 2014] [:error] [pid 3642:tid 140258619721472] File "/usr/lib/python2.7/logging/__init__.py", line 928, in _open
[Fri Nov 28 18:07:09.674001 2014] [:error] [pid 3642:tid 140258619721472] stream = open(self.baseFilename, self.mode)
[Fri Nov 28 18:07:09.674009 2014] [:error] [pid 3642:tid 140258619721472] IOError: [Errno 13] Permission denied: '/var/log/newrelic/newrelic-python-agent.log'
[Fri Nov 28 18:07:09.985905 2014] [:error] [pid 3642:tid 140258619721472] No module named wizzytest2 <---- My module name
After the module error the logs errors are about problems with database connections in general. This happens because in the wizzytest2 module I have settings overrides so that is expected.
[Sat Nov 29 21:37:44.923879 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/.virtualenvs/web' <-- python home
[Sat Nov 29 21:37:44.924177 2014] [:error] [pid 6097:tid 140297485195008] ['/home/web/.virtualenvs/web/lib/python2.7/site-packages',
[Sat Nov 29 21:37:44.924230 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/MYSITE/mysite',
[Sat Nov 29 21:37:44.924256 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/.virtualenvs/web/src/python-itunes',
[Sat Nov 29 21:37:44.924287 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/.virtualenvs/web/lib/python2.7',
[Sat Nov 29 21:37:44.924312 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/.virtualenvs/web/lib/python2.7/plat-x86_64-linux-gnu',
[Sat Nov 29 21:37:44.924342 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/.virtualenvs/web/lib/python2.7/lib-tk',
[Sat Nov 29 21:37:44.924366 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/.virtualenvs/web/lib/python2.7/lib-old',
[Sat Nov 29 21:37:44.924395 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/.virtualenvs/web/lib/python2.7/lib-dynload',
[Sat Nov 29 21:37:44.924419 2014] [:error] [pid 6097:tid 140297485195008] '/usr/lib/python2.7',
[Sat Nov 29 21:37:44.924449 2014] [:error] [pid 6097:tid 140297485195008] '/usr/lib/python2.7/plat-x86_64-linux-gnu',
[Sat Nov 29 21:37:44.924483 2014] [:error] [pid 6097:tid 140297485195008] '/usr/lib/python2.7/lib-tk',
[Sat Nov 29 21:37:44.924557 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/.virtualenvs/web/local/lib/python2.7/site-packages',
[Sat Nov 29 21:37:44.924583 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/.virtualenvs/web/local/lib/python2.7/site-packages/newrelic-2.28.0.26',
[Sat Nov 29 21:37:44.924615 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/.virtualenvs/web/lib/python2.7/site-packages',
[Sat Nov 29 21:37:44.924641 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/.virtualenvs/web/lib/python2.7/site-packages/newrelic-2.28.0.26',
[Sat Nov 29 21:37:44.924663 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/MYSITE',
[Sat Nov 29 21:37:44.924695 2014] [:error] [pid 6097:tid 140297485195008] '/home/web/MYSITE/mysite']
[Sat Nov 29 21:37:45.474168 2014] [:error] [pid 6097:tid 140297485195008] No module named wizzytest2
Just added the python path too so it's easier to debug. I also fixed the newrelic issue but that doesn't makes any difference on the settings file wizzytest2 been found or not.
Now with your logs I think the trouble is evident:
IOError: [Errno 13] Permission denied: '/var/log/newrelic/newrelic-python-agent.log/'
The user which launches your application doesn't have the right to write in '/var/log/newrelic/newrelic-python-agent.log'.
Maybe chmod -R +w '/var/log/newrelic/' can help you. But in fact, you should place the user which launch your app in an appropriate group which can write logs.
Note:
You should use uWSGI or Gunicorn for control you app and only use apache as frontend.
At the end this was an issue with permissions on the overriding settings file I wanted to import, at the end I just needed to do a chown web:web to the file and a chmod.