2017-04-24 53 views
-1
[email protected] ~/Desktop/firsrproject $ python manage.py runserver 


Performing system checks... 

Unhandled exception in thread started by <function wrapper at 0x7fbcdea6e050> 
Traceback (most recent call last): 
    File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 227, in wrapper 
    fn(*args, **kwargs) 
    File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 125, in inner_run 
    self.check(display_num_errors=True) 
    File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 359, in check 
    include_deployment_checks=include_deployment_checks, 
    File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 346, in _run_checks 
    return checks.run_checks(**kwargs) 
    File "/usr/local/lib/python2.7/dist-packages/django/core/checks/registry.py", line 81, in run_checks 
    new_errors = check(app_configs=app_configs) 
    File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line 16, in check_url_config 
    return check_resolver(resolver) 
    File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line 26, in check_resolver 
    return check_method() 
    File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 254, in check 
    for pattern in self.url_patterns: 
    File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__ 
    res = instance.__dict__[self.name] = self.func(instance) 
    File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 405, in url_patterns 
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) 
    File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__ 
    res = instance.__dict__[self.name] = self.func(instance) 
    File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 398, in urlconf_module 
    return import_module(self.urlconf_name) 
    File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module 
    __import__(name) 
    File "/home/knysys/Desktop/firsrproject/firsrproject/urls.py", line 22, in <module> 
    url(r'^', include('marcador.urls')), 
    File "/usr/local/lib/python2.7/dist-packages/django/conf/urls/__init__.py", line 50, in include 
    urlconf_module = import_module(urlconf_module) 
    File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module 
    __import__(name) 
    File "/home/knysys/Desktop/firsrproject/marcador/urls.py", line 6, in <module> 
    name='marcador_bookmark_user'), 
    File "/usr/local/lib/python2.7/dist-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(). 
+1

發表您的項目urls.py –

+0

是什麼'marcador_bookmark_user'樣子? –

+0

回溯告訴你,'marcador/urls.py'的第6行的網址格式不正確。您的問題中沒有包含該文件,因此我們無法幫助您解決問題。 – Alasdair

回答

0

從錯誤日誌,看來你urlpatterns包含urls.py上線人數22串。

django 1.10中,您無法將導入路徑傳遞到url(),需要傳遞視圖函數。

將此url(r'^', include('marcador.urls'))更改爲url(r'^posts/$', postSuccess),您需要導入from marcador.views import postSuccess

假設你marcador.views.py:

from django.shortcuts import render 
from django.http import HttpResponse 

def postSuccess(request): 
    response = "<h1>Success</h1>" 
    return HttpResponse(response) 
相關問題