In python3.4, django integrates the xadmin background method, djangoxadmin

Source: Internet
Author: User

In python3.4, django integrates the xadmin background method, djangoxadmin

Environment: window7 x64, python3.4, and django1.10

I. pip install xadmin Installation Error

1. the following error may be reported when you run the pip install xadmin command:

2. Solutions

Test-by-test

pip install git+git://github.com/sshwsfc/xadmin.git

Command can be used normally.

2. Configure xadmin in the django Project

Settings. py Configuration

INSTALLED_APPS = [  'django.contrib.admin',  'django.contrib.auth',  'django.contrib.contenttypes',  'django.contrib.sessions',  'django.contrib.messages',  'django.contrib.staticfiles',  'app.apps.AppConfig',  'xadmin',  'crispy_forms',] 

Urls. py Configuration

urlpatterns = [  # url(r'^admin/', admin.site.urls),  url(r'^xadmin/', xadmin.site.urls),] 

Create adminx. py in the blog/directory and add the following content:

From. models import Permission, Article, Category, ArticleComment, Type, Notice, EmailVerifyRecordimport xadminimport xadmin. views as xviews class BaseSetting (object): enable_themes = True use_bootswatch = Truexadmin. site. register (xviews. baseAdminView, BaseSetting) class AdminSettings (object ): # Set base_site.html's Title site_title = 'management backend '# Set Footer site_footer = '2017 admin' menu_style = 'default' in base_site.html # Set def get_site_menu (self) in the menu ): return ({'title': 'Article management', 'perm': self. get_model_perm (Article, 'change'), 'menus': ({'title': 'Article', 'icon ': 'fa fa-vimeo-square', 'url ': self. get_model_url (Article, 'angelist')}, {'title': 'test category ', 'icon': 'fa fa-vimeo-square ', 'url': self. get_model_url (Category, 'angelist')}, {'title': 'Article category', 'icon ': 'fa fa-vimeo-square', 'url': self. get_model_url (Type, 'angelist')}, {'title': 'Post comments', 'icon ': 'fa fa-vimeo-square', 'url': self. get_model_url (ArticleComment, 'angelist')},)},) xadmin. site. register (xviews. commAdminView, AdminSettings)

After the configuration is complete, do not forget to run: python3 manage. py makemigrations, python3 manage. py migrate

Now, the basic configuration is complete. You can access http: // localhost: 8000/xadmin for normal use.

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

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.