djangodjango-adminlocalhostuser-inputsuperuser

Django superuser admin


I can't load the admin login screen.

have opened a Web browser and went to “/admin/” on local domain http://127.0.0.1:8000/admin/ was supposed to open admin login window.


Solution

  • First, check if your Django server is running.You can do that, by typing python manage.py runserver in the terminal and then visiting http://127.0.0.1:8000/admin/ in your browser.

    Second, check if the Django admin is enabled. Open settings.py in your project folder and check if INSTALLED_APPS list has the django.contrib.admin element.

    Third, check if you have an admin.py file in your app directory. The code should looks something like this:

    from django.contrib import admin
    
    from .models import MyModel
    
    admin.site.register(MyModel)
    

    Fourth, Check for your login credentials in your Django settings. Go to your project's settings.py file and you have to have this code:

    LOGIN_URL = '/admin/login/'
    
    LOGIN_REDIRECT_URL = '/admin/'
    

    And the last option is to try clearing your browser cache and cookies and restarting the server.