这是我注册的xadmin APP
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'users',
'courses',
'operation',
'organization',
'xadmin',
'crispy_forms'
]
这是网址
from django.conf.urls import url
from django.contrib import admin
import xadmin
urlpatterns = [
# url(r'^admin/', admin.site.urls),
url(r'^xadmin/', xadmin.site.urls),
]
但我不知道如何处理这个问题,我刚开始学习django
File "C:\Users\PC_LF\Envs\testvir2\lib\site-packages\xadmin\__init__.py", line 4, in <module>
from xadmin.sites import AdminSite, site
File "C:\Users\PC_LF\Envs\testvir2\lib\site-packages\xadmin\sites.py", line 3, in <module>
from future.utils import iteritems
ImportError: No module named 'future'
答案 0 :(得分:1)
看起来xadmin需要python-future。您可以使用以下命令安装它:
pip install python-future
答案 1 :(得分:1)
做类似的事情......
from django.conf.urls import url,patterns
from django.contrib import admin
import xadmin
xadmin.autodiscover()
from xadmin.plugins import xversion
xversion.register_models()
urlpatterns = patterns('',
url(r'^admin/', admin.site.urls),
url(r'xadmin/', include(xadmin.site.urls)),
)
答案 2 :(得分:1)
这会解决你的问题
pip install django-import-export