Restful routes and Django

2019-05-01 12:02发布

I'm in a process of migrating Rails project into Django. Rails project was built using restful routes and it never touches the database. Instead, it simply redirects to different methods which all call an external service with the specified action method. Now, I have found a number of frameworks for django that provide restful capability plus a bunch of bells and whistles, but it's an overkill for my current case.

As an alternative, I can ignore action method in urls.py by simply providing a regex to validate urls and then parse the request method in views.py, redirecting to the appropriate method. Is this a way to go or are there any other approaches that I can look at?

标签: django rest
1条回答
狗以群分
2楼-- · 2019-05-01 12:46

Class based views look like the idiomatic way to organize restful view functions by request method.

Django snippets has several simple example implementations.

查看更多
登录 后发表回答