Alex D
Alex D

Reputation: 828

Django Admin page not displaying

A couple days ago I was able to get to the django admin login page but today when I try to hit 127.0.0.1:8000/admin I get redirected to 127.0.0.1:8000/admin/login/?next=/admin/ which brings up the DRF view for JSON testing

Am I missing something? I am not sure what would have changed. I looked at the last few days of version control and dont see where anything changed.

Upvotes: 0

Views: 826

Answers (2)

Omar2535
Omar2535

Reputation: 98

Came across a similar issue. For mw, what happened was I had my route for the API registered at the root like this:

path('', include('app.urls'))

which made the admin page render in the DRF view. Moving the app to a directory path at:

path('app', include('app.urls'))

fixes it.

Upvotes: 0

mohammadjh
mohammadjh

Reputation: 722

Once it happened to me when I unintentionally included rest_framework.urls and admin.site.urls in the same url. Such as:

url(r'^admin/', include('rest_framework.urls')),
url(r'^admin/', include(admin.site.urls)),

So, make sure these are included in defferent urls such as:

url(r'^api-auth/', include('rest_framework.urls')),
url(r'^admin/', include(admin.site.urls)),

Upvotes: 1

Related Questions