django中的问题

No module named ‘django.core.urlresolvers’

django版本2.0.2,该包在django2.0版本已经移除,其内容加到了django.urls中

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.

django有两类urls:project.urls和app.urls。
这里把对应的app.urls中加上app_name

from django.conf.urls import url,include
from . import views
app_name = "DeepAction"//加上app的名字
urlpatterns = [
    url(r'^deepaction',views.DeepAction,name="DeepAction"),
]

Bash - Curl (6) couldn’t resolve host issue

curl -X POST -H "Content-Type:application/json" --data "{'code':200,'name':1}" "127.0.0.1:8000"

–data 后面的内容需要用引号引起来

json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

同上 –data后的 字符需要双引号引起来:

curl -X POST -H "Content-Type:application/json" --data '{"code":200,"name":1}' "127.0.0.1:8000"

ImportError: No module named ‘ConfigParser’

python2中的本库在python3中已经改成了 configparser

猜你喜欢

转载自blog.csdn.net/san_junipero/article/details/79585628