Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of django-admin in Python

Shulou Source: shulou.com Published: 2022-06-01 07:53:23 09月29日 Update

This article is about the sample analysis of django-admin in Python. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.

django-admin Basic Introduction

Django provides web-based administration tools.

The Django auto-admin tool is part of django.contrib. You can see it at INSTALLED_APPS in the project's configuration file settings.py.

'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'users', 'course', 'organization', 'operation'

Activate django-admin

Usually we set it up automatically in urls.py when we generate the project, we just remove the comments.

Create superuser access to django-admin

python manage.py createsuperuser

enter your username

entry email

Enter password (at least 8 digits, not pure digits)

Confirm Password

Visit django-admin

Start: python manage.py runserver 0.0.0.0:8888

Browser visit: 127.0.0.1:8888/admin/

Change django-admin to Chinese

Modify the language_code in the configuration file setting.py to zh-hans

Change django-admin to Australia time zone

Modify TIME_ZONE in the configuration file setting.py to Asia/Shanghai

USE_TZ is False

Users released in the background can modify user information

Modify the admin.py file in the users directory

from django.contrib import admin# Register your models here.from .models import UserProfileclass UserProfileAdmin(admin.ModelAdmin): passadmin.site.register(UserProfile,UserProfileAdmin)

Thank you for reading! About "Python django-admin sample analysis" This article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!

Tags: Files users input configuration examples analysis content passwords tools more management tools articles projects management good practical digits information just background Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology NVidia Microsoft Shulou Information Xiaomi