Код: Выделить всё
500 Internal Server Error
Exception inside application.
Daphne
Это мой настройка:
Views.py (уровень приложения: основной):
Код: Выделить всё
def custom_500(request):
return render(request,'main/500.html', status=500)
Код: Выделить всё
500.html custom template file
Код: Выделить всё
from main.views import custom_400, custom_500
from django.conf.urls import handler500, handler400
handler500 = 'main.views.custom_500'
staging.py:
Код: Выделить всё
DEBUG = False
ALLOWED_HOSTS = ['domainname.com' ]
SECURE_SSL_REDIRECT = True
Я пытался перечислить все проверки, которые я пробовал:
В оболочке приложения Heroku:
Код: Выделить всё
print(settings.ALLOWED_HOSTS) # returned the domain name
print(settings.DEBUG) # returned false
print(os.getenv('DJANGO_SETTINGS_MODULE')) # mysite.settings.staging
print(settings.CSRF_COOKIE_SECURE) # true (just in case I would the app would be treated as non prod)
print(settings.SECURE_SSL_REDIRECT) # true (just in case I would the app would be treated as non prod)
Код: Выделить всё
>>> from django.shortcuts import render
>>> from django.test import RequestFactory
>>> request = RequestFactory().get('/')
>>> render(request,'main/500.html', status=500)
#returned:
Я надеюсь, что у кого-нибудь есть предложения.
Подробнее здесь: https://stackoverflow.com/questions/791 ... -rendering
Мобильная версия