导入错误:无法导入注册

时间:2013-08-22 14:44:09

标签: django django-registration

尝试从urls.py运行localhost时出现导入错误:

from django.conf.urls.defaults import *
from django.conf import settings
from django.http import HttpResponseRedirect
from django.contrib import admin
from mainapp.feeds import LatestReports, CityIdFeed, CitySlugFeed, WardIdFeed, WardSlugFeed,LatestUpdatesByReport
from mainapp.models import City
from social_auth.views import auth as social_auth
from social_auth.views import disconnect as social_disconnect
#Error at this line
from registration.views import register

from mainapp.forms import FMSNewRegistrationForm,FMSAuthenticationForm
from mainapp.views.account import SUPPORTED_SOCIAL_PROVIDERS
from django.contrib.auth import views as auth_views
from mainapp.views.mobile import open311v2
import mainapp.views.cities as cities

回溯:

ImportError at /
cannot import name register
Request Method: GET
Request URL:    http://127.0.0.1:8000/
Django Version: 1.3
Exception Type: ImportError
Exception Value:    
cannot import name register
Exception Location: /home/sourabh/Django/fixmystreet/fixmystreet/../fixmystreet/urls.py in <module>, line 9
Python Executable:  /home/sourabh/Django/fixmystreet/bin/python
Python Version: 2.7.3
Python Path:    
['/home/sourabh/Django/fixmystreet/fixmystreet',
 '/home/sourabh/Django/fixmystreet/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg',
 '/home/sourabh/Django/fixmystreet/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg',
 '/home/sourabh/Django/fixmystreet/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg',
 '/home/sourabh/Django/fixmystreet/lib/python2.7/site-packages/pip-1.1-py2.7.egg',
 '/home/sourabh/Django/fixmystreet/lib/python2.7',
 '/home/sourabh/Django/fixmystreet/lib/python2.7/plat-linux2',
 '/home/sourabh/Django/fixmystreet/lib/python2.7/lib-tk',
 '/home/sourabh/Django/fixmystreet/lib/python2.7/lib-old',
 '/home/sourabh/Django/fixmystreet/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-linux2',
 '/usr/lib/python2.7/lib-tk',
 '/home/sourabh/Django/fixmystreet/local/lib/python2.7/site-packages',
 '/home/sourabh/Django/fixmystreet/local/lib/python2.7/site-packages/PIL',
 '/home/sourabh/Django/fixmystreet/lib/python2.7/site-packages',
 '/home/sourabh/Django/fixmystreet/lib/python2.7/site-packages/PIL']
Server time:    Thu, 22 Aug 2013 09:34:40 -0500

1 个答案:

答案 0 :(得分:1)

如果查看文档,您会看到寄存器曾经存在并且在上一版本中已弃用。来自documentation

  

django-registration的1.0版本代表完全重写   之前的代码库,并介绍了几个新功能   [...]

您要么降级到django-registration v0.8(其中registration.views.register仍然存在),要么学习如何实施更改以适应最新版本

相关问题