Modify and add rich text editor on the Django 2.0 admin background management interface, djangoadmin

Source: Internet
Author: User
Tags install django pip install django

Modify and add rich text editor on the Django 2.0 admin background management interface, djangoadmin

1. File Path:

For example, if the Python environment is on the drive F: \ My \ django \ env \ Lib \ site-packages \ django \ contrib \ admin \ templates \ admin \

 

2. Modify the logon Interface Name:

Initial Django Logon: F: \ My \ django \ env \ Lib \ site-packages \ django \ contrib \ admin \ templates \ admin \ base_site.htmlmodify the name of base_site.html: {% extends "admin/base.html" % }{% block title %} Welcome to | management background of the official website of xxx environmental protection technology {% endblock % }{% block branding %} 

Display

3. Modify the background interface style:

Style File Path: F: \ My \ django \ env \ Lib \ site-packages \ django \ contrib \ admin \ static \ admin \ css \ base.css

 

4. Django Background Chinese and Time Zone Configuration:

In settings. py: Export age_code = 'zh-hans 'time _ ZONE = 'Asia/Shanghai'

 

5. Modify the name of the app displayed in the Admin background using Django:

In F: \ project \ yxhb \ app \ apps. add: class AppConfig (AppConfig): name = 'app' verbose _ name = "official website management background" To The py file in F: \ project \ yxhb \ app \__ init __. py initialization: default_app_config = 'app. apps. appconfig'

Display

6. Add a Rich Text Editor:

Install django-ckeditor:
Pip install django-ckeditor Add: INSTALLED_APPS = ['ckediter', 'ckeditor _ upload'] to the settings configuration of Django to ensure that the media path is configured, And the ckeditor upload path is under media, my configuration is also in media/upload, MEDIA_URL = '/media/' MEDIA _ ROOT = OS. path. join (BASE_DIR, 'Media ') CKEDITOR_UPLOAD_PATH = 'images/' add urls, that is, set url for ckeditor: urlpatterns = [url (r '^ admin/', admin. site. urls), url (r 'ckeditor/', include ('ckeditor _ uploader. urls ')] use the new data type and add: from django in models. db import modelsfrom ckeditor_uploader.fields import RichTextUploadingFieldclass Post (models. model): content = RichTextUploadingField (null = True, blank = True)

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.