107π
β
To address your actual question, this occurs if youβre trying to access the django server over https. Switch back to http and that error will disappear.
π€David Horn
5π
I get this kind of error when I run:
manage.py runserver ...
instead of:
manage.py runfcgi ...
because Iβm behind Nginx.
When you use runserver, it is listening for standard http web requests. When you use runfcgi, it is listening for a different type of request, using fastcgi protocol instead of plain http.
π€Mnebuerquo
- [Django]-How can I resolve 'django_content_type already exists'?
- [Django]-Django β Login with Email
- [Django]-How to redirect with messages to display them in Django Templates?
3π
You could refactor this maintenance middleware to achieve the result, because it checks the user status BEFORE processing content requests, which seems more djangonostic..
import settings
from django.http import HttpResponseRedirect
class MaintenanceModeMiddleware(object):
"""
Maintenance mode for django
If an anonymous user requests a page, he/she is redirected to the
maintenance page.
"""
def process_request(self, request):
is_login = request.path in (
settings.LOGIN_REDIRECT_URL,
settings.LOGIN_URL,
settings.LOGOUT_URL,
settings.MAINTENANCE_PATH,
)
if (not is_login) and settings.MAINTENANCE and (not request.user.is_authenticated()):
return HttpResponseRedirect(settings.MAINTENANCE_PATH)
return None
- [Django]-How do I get odd and even values in a Django for loop template?
- [Django]-Django rest framework lookup_field through OneToOneField
- [Django]-Django error: got multiple values for keyword argument
Source:stackexchange.com