1.安装xadmin,通过pip
进入virtualenv
pip安装xadmin
pyyuc:~ yuchao$ source PycharmProjects/mxvenv/bin/activate
(mxvenv) pyyuc:~ yuchao$ pip install git+git://github.com/sshwsfc/xadmin.git
结果:
Successfully built xadmin httplib2
Installing collected packages: django-crispy-forms, django-formtools, httplib2, xadmin
Successfully installed django-crispy-forms-1.7.2 django-formtools-2.1 httplib2-0.9.2 xadmin-0.6.1
(mxvenv) pyyuc:~ yuchao$ virtualenv
2.配置xadmin
INSTALLED_APPS = [
# django的admin也是一个app
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
"users",
"operation",
"organization",
"courses",
"xadmin",
#xadmin依赖的app,写法注意
"crispy_forms",
]
-
import xadmin urlpatterns = [
# url(r'^admin/', admin.site.urls),
# 修改为xadmin
url(r'^xadmin/', xadmin.site.urls),
]
-
makemigrations
migrate