I'm upgrading from Django 1.11 to Django 2.0 and getting the following error trying to load any page:
Internal Server Error: /favicon.ico Traceback (most recent call last): File "/home/andrew/projects/healthmatters/website/env/lib/python3.5/site-packages/django/core/handlers/exception.py", line 35, in inner response = get_response(request) File "/home/andrew/projects/healthmatters/website/env/lib/python3.5/site-packages/django/utils/deprecation.py", line 97, in __call__ response = self.process_response(request, response) File "/home/andrew/projects/healthmatters/website/env/lib/python3.5/site-packages/django/middleware/clickjacking.py", line 26, in process_response if response.get('X-Frame-Options') is not None: AttributeError: 'NoneType' object has no attribute 'get' [21/Dec/2017 15:19:10] "GET /favicon.ico HTTP/1.1" 500 74215 Or, if I disable that middleware, I get this: Internal Server Error: /favicon.ico Traceback (most recent call last): File "/home/andrew/projects/healthmatters/website/env/lib/python3.5/site-packages/django/core/handlers/exception.py", line 35, in inner response = get_response(request) File "/home/andrew/projects/healthmatters/website/env/lib/python3.5/site-packages/django/utils/deprecation.py", line 97, in __call__ response = self.process_response(request, response) File "/home/andrew/projects/healthmatters/website/env/lib/python3.5/site-packages/django/contrib/sessions/middleware.py", line 45, in process_response patch_vary_headers(response, ('Cookie',)) File "/home/andrew/projects/healthmatters/website/env/lib/python3.5/site-packages/django/utils/cache.py", line 285, in patch_vary_headers if response.has_header('Vary'): AttributeError: 'NoneType' object has no attribute 'has_header' This happens for / and for /favicon.ico. It seems like there is no response object by the time it hits this middleware, and indeed, adding a print statement in my view for / shows it's get() method isn't even being called. I think an exception is happening somewhere, but the attempt to render the 500 page is having issues because the middleware is saying response is None. So I've no idea what exception is causing it this time... Here's what the bit in urls.py looks like: baseurls = [ url(r'^$', landing_views.LandingPageView.as_view(), name='landing_page'), ... ] urlpatterns = baseurls + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) Here's some settings: MIDDLEWARE = ( 'db_multitenant.middleware.MultiTenantMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', #'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'corsheaders.middleware.CorsPostCsrfMiddleware', 'easytz.middleware.TimezonesMiddleware', 'impersonate.middleware.ImpersonateMiddleware', 'apps.biomarker.middleware.SubscriptionMiddleware', 'apps.biomarker.middleware.SuperuserMiddleware', 'apps.practice.middleware.TermsMiddleware', ) TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [ os.path.join(BASE_DIR, 'apps/templates'), ], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.contrib.auth.context_processors.auth', 'django.template.context_processors.request', 'django.template.context_processors.i18n', 'apps.postman.context_processors.inbox', 'apps.biomarker.context_processors.base_template_for_user_type', 'apps.menus.context_processors.menu_elements', 'django.template.context_processors.tz', 'django_settings_export.settings_export', 'apps.hm_multitenancy.context_processors.include_tenant' ] }, }, ] -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a4e1e670-949e-4433-9278-9186fb965c7e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.