I have a Django application deployed on CentOS. Here is what my httpd.conf file looks like:
WSGISocketPrefix /var/run/wsgi
<VirtualHost *:80>
WSGIDaemonProcess safe python-path=/usr/lib/python2.6/site-packages
WSGIProcessGroup safe
WSGIScriptAlias / /opt/safe/safe/wsgi.py
<Directory /opt/safe/safe/>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
EDIT: This is my TEMPLATE_DIRS
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
"/opt/safe/static/templates",
"/var/www/html/static/templates",
)
EDIT: This is my Admin/Emailing setup:
ADMINS = (
# ('Your Name', 'your_email@example.com'),
('David', 'david@localhost'),
)
SEND_BROKEN_LINK_EMAILS = True
DEFAULT_FROM_EMAIL = 'david@localhost'
SERVER_EMAIL = DEFAULT_FROM_EMAIL
In my templates directory, I have defined a custom 500.html
file. When I set my settings.py
to have DEBUG = False
, I cannot get anywhere on my site without seeing this custom 500.html page.
What's even more strange is the fact that there are no errors in the log files - so I am unsure of where to look or how to proceed. I know it can see the templates because of my custom 500.html file, but I am not sure what is causing the 500 Internal Server errors.
EDIT: After further configuration, I managed to get some errors output (thanks to @Matt Stevens), here is the log output:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 89, in get_response
response = middleware_method(request)
File "/usr/lib/python2.6/site-packages/django/middleware/common.py", line 55, in process_request
host = request.get_host()
File "/usr/lib/python2.6/site-packages/django/http/__init__.py", line 223, in get_host
"Invalid HTTP_HOST header (you may need to set ALLOWED_HOSTS): %s" % host)
SuspiciousOperation: Invalid HTTP_HOST header (you may need to set ALLOWED_HOSTS): [my ip address]