2012-03-17 54 views
2

我收到以下錯誤,當我試圖訪問http://localhost:8000/api/goal/?format=jsonTastypie網址配置不正確

ImproperlyConfigured at /api/goal/ 
The included urlconf <property object at 0x262bb50> doesn't have any patterns in it 

以下是我已經添加到我的urls.py:

goal_resource = GoalResource 

... 

    url(r'^api/', include(goal_resource.urls)), 

這裏是我的API .py:

class GoalResource(ModelResource): 
    class Meta: 
    queryset = Goal.objects.all() 
    resource_name = 'goal' 

任何想法可能會出錯?

回答

7

您需要調用GoalResource,而不是將它的內存地址綁定到變量。因此,改變

goal_resource = GoalResource 

goal_resource = GoalResource()