简体   繁体   中英

Django Admin - login

I'm building a Django Web App with Django Suit for the administration interface .

Already got have Python 2.7, Django 1.10, and MySQL communicating in harmony and started a project:

python -m django-admin startproject webapp

So, those were the steps made in the Windows PowerShell after that:

1. Start our virtual env and run the server:

PS C:\WINDOWS\system32> cd C:\PythonProjects

PS C:\PythonProjects> virtualenvs\rrh\Scripts\activate

(rrh) PS C:\PythonProjects> cd rrh/webapp

2. Setup Django Suit

(rrh) PS C:\PythonProjects\rrh\webapp> pip install django-suit==0.2.23

Then,

go to settings.py file and add the 'suit' application:

(this is how is looking on mine)

INSTALLED_APPS = [
    'suit',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

Also,

make sure you have django.template.context_processors.request ,in your TEMPLATES OPTIONS context_processors (in settings.py ):

This is required to handle left side menu.

(this is how is looking on mine)

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request', # Make sure you have this line
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

Then,

(rrh) PS C:\PythonProjects\rrh\webapp> ./manage.py collectstatic


(rrh) PS C:\PythonProjects\rrh\webapp> pip install git+https://github.com/darklow/django-suit.git

Django Suit ( https://github.com/darklow/django-suit )

The folder structure is the following:

在此处输入图片说明

The database as the following aspect (with one row in auth_user): 在此处输入图片说明

This is the screen when run the command and view in the browser the result:

(rrh) PS C:\PythonProjects\rrh\webapp> python manage.py runserver

管理员画面

The problem is: even though there's one user in the DB, with username and password, why am I not able to do the login?

Thank you for the help

created a new database, a new virtualenv, installed django, started a new django admin project, did migration, created a user, installed mysql-python, migrated to mysql, installed django suite, add the specifications to installed apps and all worked perfect.

see the django procedures I went through to make this here .

It appears you are trying to login on a part of your website which requires administrative rights.

Did you create the user with createsuperuser in ./manage.py shell ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM