2017-03-10 7 views
-4

私はDjango Webサイトを開始するために、Visual Studio 2013とPython Tools for VS 2013を使用しています。名前パターンをインポートできません - django

それは

enter image description here

完全トレースバック

Performing system checks... 

Traceback (most recent call last): 
    File "c:\users\my_username\documents\visual studio 2013\Projects\DjangoWebProject 
1\DjangoWebProject1\manage.py", line 17, in <module> 
    execute_from_command_line(sys.argv) 
    File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 
367, in execute_from_command_line 
    utility.execute() 
    File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 
359, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 
    File "C:\Python27\lib\site-packages\django\core\management\base.py", line 294, 
in run_from_argv 
    self.execute(*args, **cmd_options) 
    File "C:\Python27\lib\site-packages\django\core\management\commands\runserver. 
py", line 58, in execute 
    super(Command, self).execute(*args, **options) 
    File "C:\Python27\lib\site-packages\django\core\management\base.py", line 345, 
in execute 
    output = self.handle(*args, **options) 
    File "C:\Python27\lib\site-packages\django\core\management\commands\runserver. 
py", line 97, in handle 
    self.run(**options) 
    File "C:\Python27\lib\site-packages\django\core\management\commands\runserver. 
py", line 108, in run 
    self.inner_run(None, **options) 
    File "C:\Python27\lib\site-packages\django\core\management\commands\runserver. 
py", line 121, in inner_run 
    self.check(display_num_errors=True) 
    File "C:\Python27\lib\site-packages\django\core\management\base.py", line 374, 
in check 
    include_deployment_checks=include_deployment_checks, 
    File "C:\Python27\lib\site-packages\django\core\management\base.py", line 361, 
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 14, in c 
heck_url_config 
    return check_resolver(resolver) 
    File "C:\Python27\lib\site-packages\django\core\checks\urls.py", line 24, in c 
heck_resolver 
    for pattern in resolver.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 313, in ur 
l_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 306, in ur 
lconf_module 
    return import_module(self.urlconf_name) 
    File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module 
    __import__(name) 
    File "c:\users\my_username\documents\visual studio 2013\Projects\DjangoWebProject 
1\DjangoWebProject1\DjangoWebProject1\urls.py", line 6, in <module> 
    from django.conf.urls import patterns, url 
ImportError: cannot import name patterns 
Press any key to continue . . . 

私はこれをどのように修正することができ、次のエラーを与えますか?

+0

まず、デバッグモードではなく、これを実行し、質問に完全なトレースバックを添付してください。 – Udi

答えて

0

patternsがDjango 1.10で削除されました。代わりに、定期的なリストを使用します。

from django.conf.urls import url 

from . import views 

urlpatterns = [ 
    url(r'^articles/2003/$', views.special_case_2003), 
    url(r'^articles/([0-9]{4})/$', views.year_archive), 
    url(r'^articles/([0-9]{4})/([0-9]{2})/$', views.month_archive), 
    url(r'^articles/([0-9]{4})/([0-9]{2})/([0-9]+)/$', views.article_detail), 
] 

は、詳細はdocsを参照してください。

+0

ファイル "c:¥users¥my_usrname¥documents¥visual studio 2013¥Projects¥DjangoWebProject1¥DjangoWebProject1¥DjangoWebProject1¥urls.py"、3行目、 から。インポートビュー ImportError:名前ビューをインポートできません 任意のキーを押して続行します。 。 。 – anonymous

+0

http://i.imgur.com/PXl08Fr.png – anonymous

+0

新しい質問を始めてください。トレースバックを正しく接続してください。これで問題が解決した場合は、答えを受け入れます。 – Udi

関連する問題