I am deploying a Django project on Apache. and after configuration, I open the "localhost" in the browser, and nothing showed up and the status bar just keep saying "Waiting for localhost". Here is some info.
Environment:
OS: ubuntu
Python: 2.7.3
Django: 1.8.2
Apache: 2.2.21
Django project: /var/www/ocr_service
Apache virtualhost:
WSGIScriptAlias / /var/www/ocr_service/ocr_service/wsgi.py
WSGIPythonPath /var/www/ocr_service
<VirtualHost *:80>
LogLevel info
ErrorLog /var/www/ocr_service/log/error.log
CustomLog /var/www/ocr_service/log/access.log combined
<Directory /var/www/ocr_service >
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
</VirtualHost>
Django.wsgi file:
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ocr_service.settings")
application = get_wsgi_application()
I try with a empty django project and it works. These are what I did, can someone help me to see if somewhere is wrong?
apache2/error log report only the resuming normal operation message custom log report
mod_wsgi (pid=10***, process='',application='127.0.1.1|') loading wsgi script '/var/www/ocr_service/ocr_service/wsgi.py"
Try adding to the Apache configuration file:
See:
As the log snippet shows the WSGI file at least being loaded, which would only happen if a request is received, the issue may that you are using third party extension modules for Python that will not work in sub interpreters properly and they deadlock and hang the request. Setting that directive avoids the problem.
Also recommended that you do not use embedded mode as you are, but use daemon mode instead: