大家好,我编辑过这篇文章但仍有错误,有人可以帮忙。
错误是:
int sum(int x)
{
int d=0, a;
if(x<0)
return sum(-x);
else
a= x%10;
x= x/10;
d=d+a;
return sum(x);
else
if(x==0)
return d;
}
和urls.py是这样的:
File "C:\Users\myshop\myshop\urls.py", line 25, in <module>
url(r'^', include('shop.urls', namespace='shop')),
File "C:\Users\Faruq\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\conf.py", line 39, in include
'Specifying a namespace in include() without providing an app_name '
django.core.exceptions.ImproperlyConfigured: Specifying a namespace in include() without providing an app_name is not supported. Set the app_name attribute in the included module, or pass a 2-tuple containing the list of patterns and app_name instead.
答案 0 :(得分:1)
url(r'^', include('shop.urls', namespace='shop'),
你错过了这一行的近距离。
第三方库不能在您的代码中导致SyntaxError
。
url(path, view_or_include, namespace=string)
您需要url(r'^', include('shop.urls'), namespace='shop'),
在回答问题后,请不要将问题编辑为完全不同。 :(
答案 1 :(得分:0)
从此到:
url(r'^', include('shop.urls', namespace='shop'),
改为:
url(r'^', include('shop.urls', namespace='shop')),