开发者

Reverse URL mapping with AppEngine

开发者 https://www.devze.com 2022-12-20 04:50 出处:网络
I was wondering if there\'s a function like Django开发者_如何学JAVA\'s django.core.urlresolvers.reverse for Google\'s App Engine. I\'ve been searching everywhere but haven\'t been able to find anythin

I was wondering if there's a function like Django开发者_如何学JAVA's django.core.urlresolvers.reverse for Google's App Engine. I've been searching everywhere but haven't been able to find anything about it.

Thanks in advance


If you use webapp2, "a lightweight Python web framework compatible with Google App Engine’s webapp," you can take advantage of their URI routing features, which include a function uri_for() that does reverse routing akin to Django's reverse().

webapp2 is essentially a superset of webapp, so it's trivial to drop in as a replacement. It's a pretty sweet little library.


This isn't really anything App Engine specific - if you're using App Engine Patch, you can use Django, including its URL resolvers. Alternately, you can use any other framework with a reverse resolver, or use one on its own.


After a hard search, I found confusing documentation for similar functionality in Google App Engine's default webapp.WSGIApplication class. It seems as though regular expressions can be passed to a Handler, but they're named and used by giving extra arguments to that handler's get function.

0

精彩评论

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