I am using an Ubuntu 14.10 X86_64 system with softwares in below:
python 3.4
apache2
libapache2-mod-wsgi-py3
django1.8
I created a project by django1.8 at this path:
/var/www/html/koorimeo
I've noticed that django-admin startproject will generate a wsgi.py file by default and I haven't change its content.
I configured apache2 under the official document(How to use Django with Apache and mod_wsgi) details:
I modified 000-default.conf for I don't want to setup another Virtual Host. and This is What I added:
#000-default.conf
<VirtualHost *:80>
...
<Directory /var/www/html/koorimeo/koorimeo>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
...
</VirtualHost>
After that I declare WSGIAlias and WSGIPythonPath in apache2.conf:
#apache2.conf
#I want to leave "/" for other use...
WSGIScriptAlias /koorimeo /var/www/html/koorimeo/koorimeo/wsgi.py
WSGIPythonPath /var/www/html/koorimeo/koorimeo
After finished setting files I restarted apache2 service and login into 127.0.0.1/koorimeo, it returned a 500 error message...
I looked up the error log file and get these error message:
bing#k-lab:/var/log/apache2$ tail error.log
[Sat Apr 25 14:35:31.214661 2015] [:notice] [pid 16997:tid 140004070725504] mod_python: Creating 8 session mutexes based on 6 max processes and 25 max threads.
[Sat Apr 25 14:35:31.214705 2015] [:notice] [pid 16997:tid 140004070725504] mod_python: using mutex_directory /tmp
[Sat Apr 25 14:35:31.232634 2015] [:warn] [pid 16997:tid 140004070725504] mod_wsgi: Compiled for Python/3.4.0.
[Sat Apr 25 14:35:31.232682 2015] [:warn] [pid 16997:tid 140004070725504] mod_wsgi: Runtime using Python/2.7.6.
[Sat Apr 25 14:35:31.232766 2015] [mpm_event:notice] [pid 16997:tid 140004070725504] AH00489: Apache/2.4.7 (Ubuntu) mod_python/3.3.1 Python/2.7.6 mod_wsgi/3.4 configured -- resuming normal operations
[Sat Apr 25 14:35:31.232786 2015] [core:notice] [pid 16997:tid 140004070725504] AH00094: Command line: '/usr/sbin/apache2'
[Sat Apr 25 14:35:32.234958 2015] [core:notice] [pid 16997:tid 140004070725504] AH00051: child pid 18325 exit signal Aborted (6), possible coredump in /etc/apache2
[Sat Apr 25 14:35:32.235070 2015] [core:notice] [pid 16997:tid 140004070725504] AH00051: child pid 18326 exit signal Aborted (6), possible coredump in /etc/apache2
[Sat Apr 25 14:35:34.041184 2015] [:error] [pid 18599:tid 140003960342272] [client 127.0.0.1:51134] mod_wsgi (pid=18599): Target WSGI script '/var/www/html/koorimeo/koorimeo/wsgi.py' cannot be loaded as Python module., referer: http://localhost/
[Sat Apr 25 14:35:34.041279 2015] [:error] [pid 18599:tid 140003960342272] [client 127.0.0.1:51134] mod_wsgi (pid=18599): Exception occurred processing WSGI script '/var/www/html/koorimeo/koorimeo/wsgi.py'., referer: http://localhost/
According these message I found that apache2 can not find this module:
/var/www/html/koorimeo/wsgi.py
So I copy this path and try to get me clear wheather this file do exist:
bing#k-lab:/var/log/apache2$ ls /var/www/html/koorimeo/koorimeo/wsgi.py -l
and the system returned this message which told me that the file is truly exists...
-rw-rw-r-- 1 bing bing 389 4月 25 14:21 /var/www/html/koorimeo/koorimeo/wsgi.py
And I also make sure that I've installed libapache2-mod-wsgi-py3, I did find wsgi.so in proper location.
I've found wsgi.load in modes-enable and pointed the wsgi.so in right place:
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so
So... I am confused...
Please tell me why can't apache2 find this wsgi.py file?
Remove mod_python from Apache if you are not using it.
Your mod_wsgi module was compiled for Python 3.4.0, but mod_python was compiled for 2.7.6. Because mod_python is using a different version it is overriding what Python version is used and this will stop mod_wsgi from working.
Read the many sections in the documentation starting at:
http://code.google.com/p/modwsgi/wiki/InstallationIssues#Using_ModPython_and_ModWsgi
Related
I have been trying forever to get my django api to deploy via apache. I have installed mod_wsgi for python 3.7 and my venv is using python 3.7.15. Trying to go to my django app url I am getting a 500 error.
Error log shows:
[Tue Dec 20 21:31:30.690951 2022] [:error] [pid 19216] /usr
[Tue Dec 20 21:31:30.691287 2022] [:error] [pid 19216] mod_wsgi (pid=19216): Target WSGI script '.../project/project/wsgi.py' cannot be loaded as Python module.
[Tue Dec 20 21:31:30.691323 2022] [:error] [pid 19216] mod_wsgi (pid=19216): Exception occurred processing WSGI script '.../project/project/wsgi.py'.
[Tue Dec 20 21:31:30.691393 2022] [:error] [pid 19216] Traceback (most recent call last):
[Tue Dec 20 21:31:30.691423 2022] [:error] [pid 19216] File ".../project/project/wsgi.py", line 19, in <module>
[Tue Dec 20 21:31:30.691428 2022] [:error] [pid 19216] from django.core.wsgi import get_wsgi_application
[Tue Dec 20 21:31:30.691444 2022] [:error] [pid 19216] ModuleNotFoundError: No module named 'django'
[Tue Dec 20 21:31:51.190670 2022] [:error] [pid 19217] 3.7.15 (default, Oct 31 2022, 22:44:31)
[Tue Dec 20 21:31:51.190707 2022] [:error] [pid 19217] [GCC 7.3.1 20180712 (Red Hat 7.3.1-15)]
apache conf file:
<VirtualHost *:80>
ServerName api.project.com
DocumentRoot path/to/project/root
WSGIScriptAlias / /path/to/wsgi.py
WSGIDaemonProcess project-name processes=4 threads=1 display-name=%{GROUP} python-path=path/to/lib/python3.7/site-packages:/path/to/project/root
WSGIProcessGroup project-group
<Directory "/path/to/project/root">
Require all granted
</Directory>
#SSL stuff...
</VirtualHost>
wsgi.py:
import os
import sys
from django.core.wsgi import get_wsgi_application
path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if path not in sys.path:
sys.path.append(path)
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
application = get_wsgi_application()
I originally had the wrong mod_wsgi installed (built for python2). I removed that and installed python3-mod_wsgi.x86_64 and changed module path in httpd.conf. I then realized that my mod_wsgi was for python version 3.7, but my application venv was running python 3.6.8. I then wiped the venv and created a new one with python 3.7.15. Changed the conf WSGIDAEMONPROCESS path to the correct 3.7 site-packages. Still same error.
Just installing a virtual environment is not enough, then you'll have to activate it.
Run pip install -r requirements.txt to install the required packages for the project.
The Error
The first error line states Target WSGI script '.../project/project/wsgi.py' cannot be loaded as Python module.
This means your environment variable DJANGO_SETTINGS_MODULE is not set properly. In order to do it, go to .bashrc and set it to the same value as in the asgi.py/wsgi.py file.
Run source .bashrc to reload the configuration file, and restart the bash terminal (or open a new one) where you're trying to run the application.
This should work.
I've a weird error in a flask website.
Important : The first page (a form) is running, but when I submit, I've a 505.
I try severals things thaks to StackOverflow :), but I cannot find the solution.
Here the log :
Mon Feb 25 09:17:37.863313 2019] [wsgi:info] [pid 30874:tid 140525377849088] [remote 192.168.56.1:61092] mod_wsgi (pid=30874, process='flask_my_app', application=''): Loading WSGI script '/var/www/my_app/my_app/flask_my_app/flask_my_app.wsgi'.
[Mon Feb 25 09:17:38.191855 2019] [wsgi:error] [pid 30874:tid 140525377849088] /home/vagrant/.virtualenvs/my_app/lib/python2.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
[Mon Feb 25 09:17:38.191899 2019] [wsgi:error] [pid 30874:tid 140525377849088] """)
[Mon Feb 25 09:17:44.995445 2019] [wsgi:error] [pid 30781:tid 140525239768832] [client 192.168.56.1:3595] Truncated or oversized response headers received from daemon process 'flask_my_app': /var/www/my_app/my_app/flask_my_app/flask_my_app.wsgi, referer: http://vm.my_app/
==> /var/log/apache2/error.log <==
[Mon Feb 25 09:17:45.562808 2019] [core:notice] [pid 30767:tid 140525508945792] AH00051: child pid 30874 exit signal Segmentation fault (11), possible coredump in /etc/apache2
==> /var/log/apache2/my_app-error.log <==
[Mon Feb 25 09:17:45.589899 2019] [wsgi:info] [pid 30956:tid 140525508945792] mod_wsgi (pid=30956): Attach interpreter ''.
[Mon Feb 25 09:17:45.591070 2019] [wsgi:info] [pid 30956:tid 140525508945792] mod_wsgi (pid=30956): Adding '/var/www/my_app/my_app' to path.
[Mon Feb 25 09:17:45.595458 2019] [wsgi:info] [pid 30956:tid 140525508945792] mod_wsgi (pid=30956): Adding '/home/vagrant/.virtualenvs/my_app/lib/python2.7/site-packages' to path.
[Mon Feb 25 09:17:45.608611 2019] [wsgi:info] [pid 30956:tid 140525377849088] [remote 192.168.56.1:61092] mod_wsgi (pid=30956, process='flask_my_app', application=''): Loading WSGI script '/var/www/my_app/my_app/flask_my_app/flask_my_app.wsgi'.
[Mon Feb 25 09:17:45.916197 2019] [wsgi:error] [pid 30956:tid 140525377849088] /home/vagrant/.virtualenvs/my_app/lib/python2.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
[Mon Feb 25 09:17:45.916224 2019] [wsgi:error] [pid 30956:tid 140525377849088] """)
My Virtual Host in Apache 2.7 is here :
<VirtualHost *:80>
ServerName vm.my_app
ServerAlias vm.my_app
DocumentRoot /var/www/my_app/my_app
LogLevel info
WSGIDaemonProcess flask_my_app python-path=/var/www/my_app/my_app:/home/vagrant/.virtualenvs/my_app/lib/python2.7/site-packages display-name=%{GROUP}
WSGIProcessGroup flask_my_app
WSGIScriptAlias / /var/www/my_app/my_app/flask_my_app/flask_my_app.wsgi
WSGIApplicationGroup %{GLOBAL}
#Alias /favicon.ico /var/www/my_app/my_app/static/favicon.ico
Alias /site_media/ /var/www/my_app/my_app/site_media/
Alias /media/ /var/www/my_app/my_app/media/
Alias /static/ /var/www/my_app/my_app/static/
AliasMatch /([/]*\.css) /var/www/my_app/my_app/static/css/$1
<Directory /var/www/my_app/my_app>
Order allow,deny
Allow from all
Require all granted
</Directory>
<Directory /var/www/my_app/my_app/flask_my_app>
Order allow,deny
Allow from all
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/my_app-error.log
CustomLog ${APACHE_LOG_DIR}/my_app-access.log combined
</VirtualHost>
The python version is 2.7.12, and I use "virtual env wrapper".
The version of the wsgi module is old I think :
lrwxrwxrwx 1 root root 15 mai 3 2016 mod_wsgi.so -> mod_wsgi.so-2.7*
-rwxrwxrwx 1 root root 223K mai 3 2016 mod_wsgi.so-2.7*
The wsgi file is "classic", and the requirements.txt file :
$ cat ../requirements.txt
click==6.7
Flask==1.0.2
Flask-Assets==0.12
Flask-Caching==1.4.0
Flask-Login==0.4.1
Flask-SQLAlchemy==2.3.2
Flask-WTF==0.14.2
itsdangerous==0.24
Jinja2==2.10
MarkupSafe==1.0
pbr==5.1.1
psycopg2==2.7.5
six==1.12.0
SQLAlchemy==1.2.8
stevedore==1.30.0
webassets==0.12.1
Werkzeug==0.14.1
WTForms==2.2.1
Can anobody helps me ?
Thanks a lot
F.
It's maybe useful to others, that my issue was fixed by desactivating the SSL support !!!, in postgresql.conf :
80 ssl = off # (change requires restart)
the log :
==> /var/log/postgresql/postgresql-9.6-main.log <==
2019-03-07 15:28:28.573 CET [5346] [unknown]#[unknown] LOG: could not accept SSL connection: EOF detected
[Fri Sep 29 14:46:35.808072 2017] [wsgi:info] [pid 35637] mod_wsgi (pid=35697): Process 'swpdoc' has died, deregister and restart it.
[Fri Sep 29 14:46:35.808113 2017] [wsgi:info] [pid 35637] mod_wsgi (pid=35697): Process 'swpdoc' terminated by signal 1
[Fri Sep 29 14:46:35.808116 2017] [wsgi:info] [pid 35637] mod_wsgi (pid=35697): Process 'swpdoc' has been deregister`enter code here`ed and will no longer be monitored.
[Fri Sep 29 14:46:35.808944 2017] [wsgi:info] [pid 35699] mod_wsgi (pid=35699): Starting process 'swpdoc' with uid=48, gid=48 and threads=15.
[Fri Sep 29 14:46:35.809868 2017] [wsgi:info] [pid 35699] mod_wsgi (pid=35699): Python home /var/www/swpdoc/venswpdoc.
[Fri Sep 29 14:46:35.809895 2017] [wsgi:info] [pid 35699] mod_wsgi (pid=35699): Initializing Python.
ImportError: No module named site
WSGIScriptAlias / /var/www/swpdoc/swpdocs/swpdoc/wsgi.py
<Directory /var/www/swpdoc/swpdocs/swpdoc>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess swpdoc python-home=/var/www/swpdoc/venswpdoc python-
path=/var/www/swpdoc/swpdocs
WSGIProcessGroup swpdoc
WSGIApplicationGroup %{GLOBAL}
[root#mrsblweb21548 modules]# ldd mod_wsgi.so
linux-vdso.so.1 => (0x00007ffdd95fe000)
libpython2.7.so.1.0 => /lib64/libpython2.7.so.1.0 (0x00007f1747989000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f174776d000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f1747568000)
libutil.so.1 => /lib64/libutil.so.1 (0x00007f1747365000)
libm.so.6 => /lib64/libm.so.6 (0x00007f1747063000)
libc.so.6 => /lib64/libc.so.6 (0x00007f1746ca0000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1747f9d000)
If i use a project with django 1.9.5. it is working find and updating the django to newer version giving this error. Anyone help ?
Update:
Changed permission on virtual environment directory and now getting
permission errors:
[Fri Sep 29 19:12:35.371053 2017] [wsgi:warn] [pid 33023] (13)Permission
denied: mod_wsgi (pid=33023): Unable to stat Python home
/var/www/swpdoc/venswpdoc. Python interpreter may not be able to be
initialized correctly. Verify the supplied path and access
permissions for whole of the path.
Usually caused by you trying to make mod_wsgi use a Python virtual environment for a different version of Python than mod_wsgi was compiled for.
Check what version of Python mod_wsgi is compiled for.
http://modwsgi.readthedocs.io/en/develop/user-guides/checking-your-installation.html#python-shared-library
Indicate what version of Python your virtual environment was created against.
Usually, you only need to add the root application path to the "python-path", then it can recognize all apps in your project (I assume that "site" is an app in your project). So, you need to replace this line in your config file:
WSGIDaemonProcess swpdoc python-path=/var/www/swpdoc
If you are using a virtualenv, you can add the virtualenv packages with this line:
WSGIDaemonProcess swpdoc python-path=/var/www/swpdoc:/var/www/swpdoc/env/lib/python3.4/site-packages
You just need to replace the version of the python installed in your virtualenv.
Additionally, every time you update Django, you need to take a look at the release notes https://docs.djangoproject.com/en/1.11/releases/1.11/
I have looked at every similar question about this and still can't figure out what's wrong. I'm try to set up a python REST service on my VPS alongside my wordpress site. I can get a "Hello world" wsgi file to run no problem, but when I point to my django rest wsgi file, I get a 500 server error.
My wordpress site is in /var/www/html/mysite/public_html, and the rest service is in /var/www/html/mysite/myrest. www-data has ownership of everything in the mysite folder. I've installed all dependencies, and started the project with python manage.py runserver just to make sure it's not missing anything.
This is my wsgi file.
import os
import sys
import site
site.addsitedir('/var/www/html/mysite/myrest/lib/python2.7/site-packages')
sys.path.append('/var/www/html/mysite/myrest')
os.environ['PYTHON_EGG_CACHE'] = '/var/www/html/mysite/.python-egg'
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
Before it didn't have the site.addsitedir stuff, that got added as I tried different solutions.
There's some weird stuff going on in the apache logs, but I couldn't make sense of it.
[Sun Feb 19 20:39:33.697146 2017] [core:notice] [pid 26048] AH00094: Command line: '/usr/sbin/apache2'
[Sun Feb 19 20:41:30.804083 2017] [mpm_prefork:notice] [pid 26048] AH00169: caught SIGTERM, shutting down
[Sun Feb 19 20:41:31.707014 2017] [wsgi:warn] [pid 26721] mod_wsgi: Compiled for Python/2.7.11.
[Sun Feb 19 20:41:31.707037 2017] [wsgi:warn] [pid 26721] mod_wsgi: Runtime using Python/2.7.12.
[Sun Feb 19 20:41:31.709784 2017] [mpm_prefork:notice] [pid 26721] AH00163: Apache/2.4.18 (Ubuntu) mod_wsgi/4.3.0 Python/2.7.12 configured -- resuming normal operations
[Sun Feb 19 20:41:31.709801 2017] [core:notice] [pid 26721] AH00094: Command line: '/usr/sbin/apache2'
I'm pulling my hair out. Your help is greatly appreciated.
The problem was in my settings.py file. I managed to debug it by putting
import django
django.setup()
in various places throughout settings.py.
When I go to 52.1.65.249, the page hangs or times out. I have a django project located under a non-root user at /home/usrbkto/bkto/projbkto.
I have the same problem on two servers running ubuntu 14.04 and python 2.7.8 and ubuntu 15.04 and python 2.7.9. I believe the mod_wsgi on PyPi was compiled using python 2.7.8, so for the server running python 2.7.9 I downloaded from Github and compiled using the version of python on my server. Everything was working fine until I updated my packages all at once, so I'm not sure which package update broke things. I suspect that it has to do with the fact that I'm not using the new version of mod_wsgi correctly, but I'm not sure and I want to keep my Django project under a non-root user without access to Apache files.
My custom conf file at /etc/apache2/sites-available/bkto.conf is:
WSGIScriptAlias / /home/usrbkto/bkto/projbkto/projbkto/wsgi.py
WSGIPythonHome /home/usrbkto/vent
WSGIPythonPath /home/usrbkto/bkto/projbkto
LogLevel info
<Directory /home/usrbkto/bkto/projbkto/projbkto>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Alias /media/ /home/usrbkto/bkto/projbkto/media/
Alias /static/ /home/usrbkto/bkto/projbkto/static/
<Directory /home/usrbkto/bkto/projbkto/static>
Require all granted
</Directory>
<Directory /home/usrbkto/bkto/projbkto/media>
Require all granted
</Directory>
The apache error.log is:
[Mon Jun 01 05:14:41.082545 2015] [mpm_event:notice] [pid 32630:tid 140666831587200] AH00489: Apache/2.4.10 (Ubuntu) mod_wsgi/4.4.12 Python/2.7.9 configured -- resuming normal operations
[Mon Jun 01 05:14:41.082692 2015] [mpm_event:info] [pid 32630:tid 140666831587200] AH00490: Server built: Mar 9 2015 11:53:48
[Mon Jun 01 05:14:41.082713 2015] [core:notice] [pid 32630:tid 140666831587200] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jun 01 05:14:41.083297 2015] [wsgi:info] [pid 32634:tid 140666831587200] mod_wsgi (pid=32634): Python home /home/usrbkto/venv.
[Mon Jun 01 05:14:41.083401 2015] [wsgi:info] [pid 32634:tid 140666831587200] mod_wsgi (pid=32634): Initializing Python.
[Mon Jun 01 05:14:41.089325 2015] [wsgi:info] [pid 32632:tid 140666831587200] mod_wsgi (pid=32632): Python home /home/usrbkto/venv.
[Mon Jun 01 05:14:41.089442 2015] [wsgi:info] [pid 32632:tid 140666831587200] mod_wsgi (pid=32632): Initializing Python.
[Mon Jun 01 05:14:41.181394 2015] [wsgi:info] [pid 32634:tid 140666831587200] mod_wsgi (pid=32634): Attach interpreter ''.
[Mon Jun 01 05:14:41.181479 2015] [wsgi:info] [pid 32634:tid 140666831587200] mod_wsgi (pid=32634): Adding '/home/usrbkto/bkto/projbkto' to path.
[Mon Jun 01 05:14:41.182781 2015] [wsgi:info] [pid 32634:tid 140666831587200] mod_wsgi (pid=32634): Imported 'mod_wsgi'.
[Mon Jun 01 05:14:41.186652 2015] [wsgi:info] [pid 32632:tid 140666831587200] mod_wsgi (pid=32632): Attach interpreter ''.
[Mon Jun 01 05:14:41.186718 2015] [wsgi:info] [pid 32632:tid 140666831587200] mod_wsgi (pid=32632): Adding '/home/usrbkto/bkto/projbkto' to path.
[Mon Jun 01 05:14:41.212429 2015] [wsgi:info] [pid 32632:tid 140666831587200] mod_wsgi (pid=32632): Imported 'mod_wsgi'.
[Mon Jun 01 05:14:47.101220 2015] [wsgi:info] [pid 32634:tid 140666698360576] mod_wsgi (pid=32634): Create interpreter 'ip-172-31-4-180.ec2.internal|'.
[Mon Jun 01 05:14:47.102574 2015] [wsgi:info] [pid 32634:tid 140666698360576] mod_wsgi (pid=32634): Adding '/home/usrbkto/bkto/projbkto' to path.
[Mon Jun 01 05:14:47.104087 2015] [wsgi:info] [pid 32634:tid 140666698360576] [client 64.94.31.206:47918] mod_wsgi (pid=32634, process='', application='ip-172-31-4-180.ec2.internal|'): Loading WSGI script '/home/usrbkto/bkto/projbkto/projbkto/wsgi.py'.
[Mon Jun 01 05:16:46.847615 2015] [wsgi:info] [pid 32632:tid 140666612999936] mod_wsgi (pid=32632): Create interpreter 'ip-172-31-4-180.ec2.internal|'.
[Mon Jun 01 05:16:46.848995 2015] [wsgi:info] [pid 32632:tid 140666612999936] mod_wsgi (pid=32632): Adding '/home/usrbkto/bkto/projbkto' to path.
[Mon Jun 01 05:16:46.850506 2015] [wsgi:info] [pid 32632:tid 140666612999936] [client 166.137.244.128:61084] mod_wsgi (pid=32632, process='', application='ip-172-31-4-180.ec2.internal|'): Loading WSGI script '/home/usrbkto/bkto/projbkto/projbkto/wsgi.py'.
The wsgi.py file at /home/usrbkto/bkto/projbkto/projbkto/wsgi.py is:
"""
WSGI config for projbkto project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "projbkto.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
The mod_wsgi versions of PyPi are source code and not binaries. To say the mod_wsgi on PyPi is compiled with a certain Python version doesn't make any sense as they are compiled on your own system using whatever Python version you have.
Anyway, read this and try the remedy given:
http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Python_Simplified_GIL_State_API
This is the usual fix for lock ups caused by Python C extensions which aren't coded properly to work in sub interpreters.
Also stop using embedded mode and use daemon mode instead:
http://blog.dscpl.com.au/2012/10/why-are-you-using-embedded-mode-of.html
If these don't help, indicate whether it is easily reproducible or random.