我正在嘗試爲我的研究創建一個Facebook提取器。爲了這個目的我嘗試了很多庫,但是找不到一個例子。最後我已經達到了這個repository,我猜是我在找的東西。ImportError:無法在django應用程序中導入名稱模式
但問題是,當我跑了,我凸輪跨以下錯誤E:
Performing system checks...
Unhandled exception in thread started by <function wrapper at 0x0000000004540518>
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\django\utils\autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "C:\Python27\lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run
self.check(display_num_errors=True)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 359, in check
include_deployment_checks=include_deployment_checks,
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 346, in _run_checks
return checks.run_checks(**kwargs)
File "C:\Python27\lib\site-packages\django\core\checks\registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "C:\Python27\lib\site-packages\django\core\checks\urls.py", line 16, in check_url_config
return check_resolver(resolver)
File "C:\Python27\lib\site-packages\django\core\checks\urls.py", line 26, in check_resolver
return check_method()
File "C:\Python27\lib\site-packages\django\urls\resolvers.py", line 254, in check
for pattern in self.url_patterns:
File "C:\Python27\lib\site-packages\django\utils\functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Python27\lib\site-packages\django\urls\resolvers.py", line 405, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "C:\Python27\lib\site-packages\django\utils\functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Python27\lib\site-packages\django\urls\resolvers.py", line 398, in urlconf_module
return import_module(self.urlconf_name)
File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "C:\Users\lenovo-pc\Desktop\psa-allauth-master\example\urls.py", line 1, in <module>
from django.conf.urls import patterns, include, url
ImportError: cannot import name patterns
我感到相當這個錯誤感到困惑,因爲我遇到它的第一次。告訴我我能做些什麼來改進代碼?我使用Django 1.11.5
和Python 2.7.2
。也沒有關於社交認證的Django 1.11.5
的例子,所以任何人都可以幫助我。這將是一個很大的幫助。 如果我刪除pattern
我得到以下錯誤:
File "C:\Python27\lib\site-packages\django\conf\urls\__init__.py", line 85, in url
raise TypeError('view must be a callable or a list/tuple in the case of include().')
TypeError: view must be a callable or a list/tuple in the case of include().
導入錯誤是[此問題]的重複(https://stackoverflow.com/questions/38786036/importerror-cannot-import-name-patterns)。一旦你刪除了導入,'視圖必須是可調用的或者列表/元組'錯誤是[this one]的重複(https://stackoverflow.com/questions/38744285/django-urls-error-view - 必須是可調用的或列表中的元組) – Alasdair