开发者

Use first param in django URL

I开发者_如何学C want to to know if its possible to use the first "segment" of a Django URL as a parameter and what would that regex look like.

example:

(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
#### I want to use the following
(r'^THISISMYPARAM$, include("whatever")),

So then when someone visited http://example.com/SOMETHING I could use do something with that.

My regex keeps breaking my other urls :\


You can do something like this:

(r'^(?P<thisismyparam>\w+)$', include('whatever'))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜