The teaching of using graphics and text in Django background management system

Time:2020-6-3

Checking the configuration file of Django background management system

Check root urls.py file

Start the project, enter IP port / admin in the browser, for example: 127.0.0.1/8000/admin enter

Registration background management system super management

1. Create ා create a normal user with clear password (not recommended)
2.create_ User ා create a normal user, password ciphertext (recommended)
3. Createsuperuser ා create super user (recommended)
#Command statement
python manage.py createsuperuser
Username (leave blank to use ‘7981 Python’): root ා use ‘7981 Python’ by default
Email address: optional email address
Password: ා minimum 8 digits, cannot be a pure number / character
Password (again): ා confirm the password and input it again
Superuser created successfully

Login account and password

Add database table to background management system for simple view

Set background management system, field value can be empty

Note: the effect of setting the field value of the background management system to null is to write a null string in the database. Generally, blank = true and null = true are used together to prevent data errors from modifying the field display name of the background management system

Set whether a field can be modified by background management system

Prompt to fill in field value information

Set field value options that can be modified by background management system

Modify table name information

Use of rich text editor

#Rich text editor function: write beautiful, formatted text information
1. Install the module
– pip3 install django-tinymce==2.6.0

Two settings.py Profile installed_ Apps add editor application
INSTALLED_APPS = (
……,
‘TinyMCE’, register rich text editor
)

3. In settings.py Add edit configuration to
TINYMCE_DEFAUL_CONFIG = {
‘theme’: ‘advanced’, rich text function
‘width’: 600, width
‘height’: 400, height
}

4. Root urls.py Configure URL in (to use routing distribution)
urlpatterns = [
……,
url(r’^tinymce/’,include(‘tinymce.urls’)),
]

5. For the application in models, you can register to use admin

The above is all the knowledge content of this introduction. If you have any questions, you can contact the developer editor.