2013-08-22 301 views
-1

获取导入错误,而试图从我urls.py运行本地主机:导入错误:无法导入注册

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 
+2

:)同时投票下来,请考虑提及什么是不明确的pr会徽? – shifu

+0

您是否在使用['django-registration'](https://bitbucket.org/ubernostrum/django-registration)? –

+0

你试过了什么?在哪里注册?你的python路径是什么样的? – RickyA

回答

1

如果你看的文档,你看到寄存器的东西,曾经存在并且在上一个版本中被弃用。从documentation

的Django登记的1.0版本代表了以前的代码库的完全重写 ,并引入了一些新功能,其中 [...]

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

相关问题