I upgraded Django from 2.2 to 3.0, Now I can't access admin page.
Every time I access http://127.0.0.1:8000/admin the dev. server quits without any message or error.
If I revert back to Django 2.2 everything works fine.
I did fresh virtualenv and created new project unfortunately, I hit the same wall again the Dev. server quits without any error.
Is this a common issue or do I have any error?
I am using windows 10 64-bit and Pycharm community 2019.2.5
my virtual is:
Package Version
------------------- ----------
asgiref==3.2.3
certifi==2019.11.28
chardet==3.0.4
Django==3.0
djangorestframework==3.10.3
idna==2.8
Pillow==6.2.1
pip==19.3.1
PyJWT==1.7.1
pytz==2019.3
requests==2.22.0
setuptools==42.0.2
six==1.13.0
sqlparse==0.3.0
twilio==6.34.0
urllib3==1.25.7
wheel==0.33.6
Stack trace
System check identified no issues (0 silenced).
December 06, 2019 - 21:59:45
Django version 3.0, using settings 'suhul_prj.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[06/Dec/2019 21:59:56] "GET / HTTP/1.1" 200 16351
[06/Dec/2019 21:59:56] "GET /static/admin/css/fonts.css HTTP/1.1" 200 423
[06/Dec/2019 21:59:56] "GET /static/admin/fonts/Roboto-Regular-webfont.woff HTTP/1.1" 200 85876
[06/Dec/2019 21:59:56] "GET /static/admin/fonts/Roboto-Bold-webfont.woff HTTP/1.1" 200 86184
[06/Dec/2019 21:59:56] "GET /static/admin/fonts/Roboto-Light-webfont.woff HTTP/1.1" 200 85692
[06/Dec/2019 22:00:02] "GET /admin HTTP/1.1" 301 0
[06/Dec/2019 22:00:02] "GET /admin/ HTTP/1.1" 302 0
[06/Dec/2019 22:00:02] "GET /admin/login/?next=/admin/ HTTP/1.1" 200 1913
[06/Dec/2019 22:00:03] "GET /static/admin/css/base.css HTTP/1.1" 200 16378
[06/Dec/2019 22:00:03] "GET /static/admin/css/login.css HTTP/1.1" 200 1233
[06/Dec/2019 22:00:03] "GET /static/admin/css/responsive.css HTTP/1.1" 200 18052
[06/Dec/2019 22:00:08] "POST /admin/login/?next=/admin/ HTTP/1.1" 302 0
(home_venv) C:\Users\Admin\Dropbox\django_projects\suhul_prj>
looks like this problem going back to python and Django versions incompatibility, which caused WSGI segmentation fault, I had the same issue while I was using python 3.7 and with downgrading python to 3.6 it has been solved!
Just want to share my experience solving the same issue.
I used python v3.7 and got this issue. Solved this problem by upgrading to python v3.8 and creating a new venv.
Now my python version FYI:
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] on win32
Also another post mentioned this issue.
Related
I'm new to python and django.
I've copied my production app, that another developer wrote, onto my local. It's working perfectly. When I run django admin I get the login form. But when I enter my ID and PW I get redirected to the same login form, only it's blank; I never get logged in.
The server console reads:
[26/Apr/2022 06:25:21] "POST /admin/login/?next=/admin/ HTTP/1.1" 302 0
[26/Apr/2022 06:25:21] "GET /admin/ HTTP/1.1" 302 0
[26/Apr/2022 06:25:21] "GET /admin/login/?next=/admin/ HTTP/1.1" 200 11020
I don't understand what's needed to change or get added. Any help appreciated.
I've sorted the issue.
I commented out SESSION_COOKIE_DOMAIN from my settings.py file and that solved it.
When I am learning Django,
The console usually hint me:
"GET /new_entry/5 HTTP/1.1" 200 466
What's the purpose of 200 466?
The 200 is the HTTP status code, which means the request completed successfully. The second number is the size of the request in bytes.
I am using Django 1.9, Python 3, running locally on Docker (for testing)
Trying to integrate django-saml2-auth into my application.
Pretty much followed all the steps in the docs:
1) All installations were successful
2) New URLs were imported above the rest
3) Installed apps includes 'django_saml2_auth'
4) 'SAML2_AUTH' dict was placed in settings (and all attributes were mapped)
5) In the SAML2 identity provider (using OneLogin), the Single-sign-on URL and Audience URI(SP Entity ID) was set to http://127.0.0.1:8000/saml2_auth/acs/
What happens is that when I get to http://127.0.0.1:8000/admin the browser goes into an infinite redirect loop:
...
[02/May/2018 15:43:06] "GET /admin/ HTTP/1.1" 302 0
[02/May/2018 15:43:06] "GET /admin/login/?next=/admin/ HTTP/1.1" 302 0
[02/May/2018 15:43:07] "POST /saml2_auth/acs/ HTTP/1.1" 302 0
[02/May/2018 15:43:07] "GET /admin/ HTTP/1.1" 302 0
[02/May/2018 15:43:07] "GET /admin/login/?next=/admin/ HTTP/1.1" 302 0
[02/May/2018 15:43:08] "POST /saml2_auth/acs/ HTTP/1.1" 302 0
[02/May/2018 15:43:08] "GET /admin/ HTTP/1.1" 302 0
...
When I disable django-saml2-auth I see that a staff user was created.
In the OneLogin interface I can see that I logged in successfully.
Overriding django_saml2_auth.views.signin(r), where r is a django.core.handlers.wsgi.WSGIRequest, for <WSGIRequest: GET '/admin/login/?next=/admin/'>, and in the request, the user is set to AnonymousUser, COOKIES contain sessionid and csrftoken.
I would expect that a session would start for the user that was created/fetched, and that I will get to an /admin/<whatever> page.
I will appreciate any help in debugging this, thank you!
EDIT: I was able to get it to work by removing AUTHENTICATION_BACKENDS from settings.py- I have 3 other backends that I use. It seems like they conflict with django-saml2-auth.
Is there any way to get django-saml2-auth to work with other backends?
EDIT 2: Will try to integrate django-saml2-pro-auth, which has a backend so will not conflict. I would really appreciate some insight though.
EDIT 3: back to EDIT 2, when I remove all the backends and they don't conflict, the log flow looks like that:
[04/May/2018 15:24:26] "GET /admin/ HTTP/1.1" 302 0
[04/May/2018 15:24:27] "GET /admin/login/?next=/admin/ HTTP/1.1" 302
[04/May/2018 15:26:27] "POST /saml2_auth/acs/ HTTP/1.1" 302 0
[04/May/2018 15:26:27] "GET /admin/ HTTP/1.1" 200 38398
Where the last GET does not get redirected, with 200.
Issue resolved:
After taking a deeper dive- it seems like this code is the issue:
In django_saml2_auth/views.py, acs():
if target_user.is_active:
target_user.backend = 'django.contrib.auth.backends.ModelBackend'
login(r, target_user)
else:
return HttpResponseRedirect(get_reverse([denied, 'denied', 'django_saml2_auth:denied']))
It seems like the default ModelBackend is necessary.
When other backends are used, the default is no longer used by Django, and hence the infinite loop.
If the default backend is added to the list of backends, everything works as intended.
I updated yesterday from django 1.8.6 to 1.9.1 and my project went smoothly. But as I was coding, I noticed a message in the command prompt. It says
Not Found: /ticket/222
[05/Jan/2016 10:29:05] "GET /ticket/222 HTTP/1.1" 301 0
[05/Jan/2016 10:29:05] "GET /ticket/222/ HTTP/1.1" 200 9972
Sometimes it appears like this. But I swear, it is there.
Not Found: /favicon.ico
[12/Jan/2016 10:32:09] "GET /favicon.ico HTTP/1.1" 404 3254
222 is the id and the weird thing is, I am looking at 222's details on my page. Any explanations for this? Or is this a bug? Should I be bothered by this?
EDIT
Seems like no one can give me answers. So I'll have this closed but if anyone have a clue on this, just comment down below.
This problem only debug-toolbar-1.0.1.
If downgrade to django-debug-toolbar==0.9.4 - all works.
Django==1.5.5(I try Django 1.6, but problem the same).
I running server, and can't see panel(django-debug-toolbar).
In log:
[17/Jan/2014 03:05:16] "GET / HTTP/1.1" 200 10644
[17/Jan/2014 03:05:16] "GET /static/debug_toolbar/js/jquery.cookie.js HTTP/1.1" 304 3623
[17/Jan/2014 03:05:16] "GET /static/debug_toolbar/js/toolbar.js HTTP/1.1" 304 10216
[17/Jan/2014 03:05:16] "GET /static/debug_toolbar/css/toolbar.css HTTP/1.1" 304 22959
Anyone with a similar problem?
Sorry for my english.
There's a few changes between 0.9.4 and 1.0. The changelist recommends that you review the installation and configuration docs and redo the setup in your projects.
I suggest retrying the setup as it suggests. If it still doesn't work, then update your question with your configuration, and somebody might be able to help.