Tôi có một ứng dụng Django được triển khai trên CentOS. Đây là những gì file httpd.conf của tôi trông giống như:Django Apache mod_wsgi 500
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: Đây là tôi 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: Đây là quản lý của tôi/gửi email thiết lập:
ADMINS = (
# ('Your Name', '[email protected]'),
('David', '[email protected]'),
)
SEND_BROKEN_LINK_EMAILS = True
DEFAULT_FROM_EMAIL = '[email protected]'
SERVER_EMAIL = DEFAULT_FROM_EMAIL
Trong tôi thư mục mẫu, tôi đã xác định tệp 500.html
tùy chỉnh. Khi tôi đặt số settings.py
của mình thành DEBUG = False
, tôi không thể đến bất kỳ đâu trên trang web của mình mà không thấy trang 500.html tùy chỉnh này.
Điều kỳ lạ hơn nữa là thực tế là không có lỗi trong tệp nhật ký - vì vậy tôi không chắc chắn về nơi cần tìm hoặc cách tiếp tục. Tôi biết nó có thể thấy các mẫu vì tệp 500.html tùy chỉnh của tôi, nhưng tôi không chắc chắn nguyên nhân gây ra lỗi 500 Máy chủ nội bộ.
EDIT: Sau khi cấu hình hơn nữa, tôi quản lý để có được một số lỗi đầu ra (nhờ @ Matt Stevens), đây là sản phẩm ghi:
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]
khi bạn đặt gỡ lỗi thành đúng, mọi chức năng có bình thường không? –
có - Tôi có thể truy cập mọi thứ bình thường (tất cả các URL của tôi đều hoạt động, mọi thứ). – lightningmanic
Mẫu template_dir của bạn trông như thế nào? –