zoukankan      html  css  js  c++  java
  • 安装xadmin后台管理

    安装xadmin后台管理

    下载xadmin源码包

    https://github.com/sshwsfc/xadmin
    得到 xadmin-master.zip
    

    安装xadmin-master.zip

    注意:需要先加入压缩包,把README.rst用一个同名的空文件替换
    (Django_login) D:>pip install xadmin-master.zip
    Processing d:xadmin-master.zip
    Requirement already satisfied: setuptools in e:venvdjango_loginlibsite-packagessetuptools-39.1.0-py3.6.egg (from xadmin==0.6.1) (39.1.0)
    
    Requirement already satisfied: django>=1.9.0 in e:venvdjango_loginlibsite-packages (from xadmin==0.6.1) (1.11.12)
    Collecting django-crispy-forms>=1.6.0 (from xadmin==0.6.1)
      Using cached https://files.pythonhosted.org/packages/9a/05/6bad05742d185ec2fabfa4deab05cafde286eb3f383fba24b3674340aca2/django_crispy_forms
    -1.7.2-py2.py3-none-any.whl
    Collecting django-reversion>=2.0.0 (from xadmin==0.6.1)
      Using cached https://files.pythonhosted.org/packages/df/df/8f049266fe2b1cf6e33129b0368cbf1aa55a5813300c44226190f7b7c3f8/django_reversion-3.
    0.0-py2.py3-none-any.whl
    Collecting django-formtools>=1.0 (from xadmin==0.6.1)
      Using cached https://files.pythonhosted.org/packages/97/3f/b8e04c41c028d5cdad651393abea1f686d846c717d8ab5d5ebe2974f711c/django_formtools-2.
    1-py2.py3-none-any.whl
    Collecting django-import-export>=0.5.1 (from xadmin==0.6.1)
      Using cached https://files.pythonhosted.org/packages/60/f7/0cbec58d990fa8eeab1ef6988cde79a8aab6bb5c2cf93a8d4f831992e6ab/django_import_expor
    t-1.0.1-py2.py3-none-any.whl
    Collecting httplib2==0.9.2 (from xadmin==0.6.1)
      Using cached https://files.pythonhosted.org/packages/ff/a9/5751cdf17a70ea89f6dde23ceb1705bfb638fd8cee00f845308bf8d26397/httplib2-0.9.2.tar.
    gz
    Collecting future (from xadmin==0.6.1)
      Using cached https://files.pythonhosted.org/packages/00/2b/8d082ddfed935f3608cc61140df6dcbf0edea1bc3ab52fb6c29ae3e81e85/future-0.16.0.tar.g
    z
    Collecting six (from xadmin==0.6.1)
      Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-
    none-any.whl
    Requirement already satisfied: pytz in e:venvdjango_loginlibsite-packages (from django>=1.9.0->xadmin==0.6.1) (2018.5)
    Collecting diff-match-patch (from django-import-export>=0.5.1->xadmin==0.6.1)
      Using cached https://files.pythonhosted.org/packages/22/82/46eaeab04805b4fac17630b59f30c4f2c8860988bcefd730ff4f1992908b/diff-match-patch-20
    121119.tar.gz
    Collecting tablib (from django-import-export>=0.5.1->xadmin==0.6.1)
      Using cached https://files.pythonhosted.org/packages/e4/9f/cba4e1145ca9ec84d9326f7ce38c6b5f37d9be8bc1af1bd8b19c20374095/tablib-0.12.1.tar.g
    z
    Collecting odfpy (from tablib->django-import-export>=0.5.1->xadmin==0.6.1)
      Using cached https://files.pythonhosted.org/packages/01/0f/c9971c99d0d06024a1652f467427ff3f1a1136237e5740da715c5b208a48/odfpy-1.3.6.tar.gz
    Collecting openpyxl (from tablib->django-import-export>=0.5.1->xadmin==0.6.1)
      Using cached https://files.pythonhosted.org/packages/ef/2b/d61297ec61caddfe2935459e6c4600f37f74ebf4b794c4d28863958715bd/openpyxl-2.5.7.tar.
    gz
    Collecting unicodecsv (from tablib->django-import-export>=0.5.1->xadmin==0.6.1)
      Using cached https://files.pythonhosted.org/packages/6f/a4/691ab63b17505a26096608cc309960b5a6bdf39e4ba1a793d5f9b1a53270/unicodecsv-0.14.1.t
    ar.gz
    Collecting xlrd (from tablib->django-import-export>=0.5.1->xadmin==0.6.1)
      Using cached https://files.pythonhosted.org/packages/07/e6/e95c4eec6221bfd8528bcc4ea252a850bffcc4be88ebc367e23a1a84b0bb/xlrd-1.1.0-py2.py3-
    none-any.whl
    Collecting xlwt (from tablib->django-import-export>=0.5.1->xadmin==0.6.1)
      Using cached https://files.pythonhosted.org/packages/44/48/def306413b25c3d01753603b1a222a011b8621aed27cd7f89cbc27e6b0f4/xlwt-1.3.0-py2.py3-
    none-any.whl
    Collecting pyyaml (from tablib->django-import-export>=0.5.1->xadmin==0.6.1)
      Using cached https://files.pythonhosted.org/packages/4f/ca/5fad249c5032270540c24d2189b0ddf1396aac49b0bdc548162edcf14131/PyYAML-3.13-cp36-cp
    36m-win_amd64.whl
    Collecting jdcal (from openpyxl->tablib->django-import-export>=0.5.1->xadmin==0.6.1)
      Using cached https://files.pythonhosted.org/packages/a0/38/dcf83532480f25284f3ef13f8ed63e03c58a65c9d3ba2a6a894ed9497207/jdcal-1.4-py2.py3-n
    one-any.whl
    Collecting et_xmlfile (from openpyxl->tablib->django-import-export>=0.5.1->xadmin==0.6.1)
      Using cached https://files.pythonhosted.org/packages/22/28/a99c42aea746e18382ad9fb36f64c1c1f04216f41797f2f0fa567da11388/et_xmlfile-1.0.1.ta
    r.gz
    Installing collected packages: django-crispy-forms, django-reversion, django-formtools, diff-match-patch, odfpy, jdcal, et-xmlfile, openpyxl,
     unicodecsv, xlrd, xlwt, pyyaml, tablib, django-import-export, httplib2, future, six, xadmin
      Running setup.py install for diff-match-patch ... done
      Running setup.py install for odfpy ... done
      Running setup.py install for et-xmlfile ... done
      Running setup.py install for openpyxl ... done
      Running setup.py install for unicodecsv ... done
      Running setup.py install for tablib ... done
      Running setup.py install for httplib2 ... done
      Running setup.py install for future ... done
      Running setup.py install for xadmin ... done
    Successfully installed diff-match-patch-20121119 django-crispy-forms-1.7.2 django-formtools-2.1 django-import-export-1.0.1 django-reversion-3
    .0.0 et-xmlfile-1.0.1 future-0.16.0 httplib2-0.9.2 jdcal-1.4 odfpy-1.3.6 openpyxl-2.5.7 pyyaml-3.13 six-1.11.0 tablib-0.12.1 unicodecsv-0.14.
    1 xadmin-0.6.1 xlrd-1.1.0 xlwt-1.3.0
    
    查看包的情况
    (Django_login) D:>pip list
    Package              Version
    -------------------- --------
    diff-match-patch     20121119
    Django               1.11.12
    django-crispy-forms  1.7.2
    django-formtools     2.1
    django-import-export 1.0.1
    django-reversion     3.0.0
    et-xmlfile           1.0.1
    future               0.16.0
    httplib2             0.9.2
    jdcal                1.4
    odfpy                1.3.6
    openpyxl             2.5.7
    pip                  10.0.1
    pytz                 2018.5
    PyYAML               3.13
    setuptools           39.1.0
    six                  1.11.0
    tablib               0.12.1
    unicodecsv           0.14.1
    xadmin               0.6.1
    xlrd                 1.1.0
    xlwt                 1.3.0
    
    

    将包解压,获取里面的xadmin文件

    拷贝到项目的根目录下

    修改urls.py文件

    from django.conf.urls import url
    import xadmin
    
    urlpatterns = [
        # url('admin/', admin.site.urls),
        url('xadmin/',xadmin.site.urls),
    ]
    

    注册app

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

    数据库中创建相关表

    (Django_login) D:demoDjango_login>python manage.py makemigrations
    No changes detected
    
    (Django_login) D:demoDjango_login>python manage.py migrate
    Operations to perform:
      Apply all migrations: admin, auth, contenttypes, sessions, xadmin
    Running migrations:
      Applying contenttypes.0001_initial... OK
      Applying auth.0001_initial... OK
      Applying admin.0001_initial... OK
      Applying admin.0002_logentry_remove_auto_add... OK
      Applying contenttypes.0002_remove_content_type_name... OK
      Applying auth.0002_alter_permission_name_max_length... OK
      Applying auth.0003_alter_user_email_max_length... OK
      Applying auth.0004_alter_user_username_opts... OK
      Applying auth.0005_alter_user_last_login_null... OK
      Applying auth.0006_require_contenttypes_0002... OK
      Applying auth.0007_alter_validators_add_error_messages... OK
      Applying auth.0008_alter_user_username_max_length... OK
      Applying sessions.0001_initial... OK
      Applying xadmin.0001_initial... OK
      Applying xadmin.0002_log... OK
      Applying xadmin.0003_auto_20160715_0100... OK
    
    (Django_login) D:demoDjango_login>python manage.py createsuperuser
    Username (leave blank to use 'spider'): admin
    Email address: admin@12.cn
    Password:
    Password (again):
    Superuser created successfully.
    
    

    登陆后台

  • 相关阅读:
    关于 IIS 上运行 ASP.NET Core 站点的“HTTP 错误 500.19”错误
    下单快发货慢:一个 JOIN SQL 引起 SqlClient 读取数据慢的奇特问题
    ASP.NET Core 2.2 项目升级至 3.0 备忘录
    corefx 源码学习:SqlClient 是如何同步建立 Socket 连接的
    Chimee
    electron-vue:Vue.js 开发 Electron 桌面应用
    H5网页适配 iPhoneX,就是这么简单
    经典文摘:饿了么的 PWA 升级实践(结合Vue.js)
    Table Dragger
    分享8个网站开发中最好用的打印页面插件
  • 原文地址:https://www.cnblogs.com/endmoon/p/9744723.html
Copyright © 2011-2022 走看看