Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Django匹配简单标题的URL_Python_Django_Url - Fatal编程技术网

Python Django匹配简单标题的URL

Python Django匹配简单标题的URL,python,django,url,Python,Django,Url,我正在尝试匹配django项目中的url。我的URL是这样的http://localhost:8000/article/Google-Home-Sales-outface-Amazons-Alexa-For-First-Time-13545和url.py a增加了: path('article/(?P<article_title>[\w\d.\'%@+-]+)', views.article) def article(request, article_title)): pa

我正在尝试匹配django项目中的url。我的URL是这样的
http://localhost:8000/article/Google-Home-Sales-outface-Amazons-Alexa-For-First-Time-13545
和url.py a增加了:

path('article/(?P<article_title>[\w\d.\'%@+-]+)', views.article)

def article(request, article_title)):
    pass
path('article/(?P[\w\d.\'%@+-]+'),views.article)
def条款(请求,条款标题):
通过

但这不起作用。有人能帮我吗?

使用
re\u path
而不是
path
,如中所示