Re: [flask] migrating from pylons
- Cornelius Kölbel
- 2014-11-03 @ 21:57
Am 03.11.2014 um 20:58 schrieb Cornelius Kölbel:
> I am checking to migrate my web application privacyidea from pylons (was
> started in the end of 2009!) to flask.
> So forgive me if I am still in the old pylons thinking way of
> controllers and methods.
> Also, I am sure, that the questions of my answers can be found somewhere
> in the documentation, but I would also be grateful if you can also add
> your own experiences and opinions.
> I am wondering about two points:
> 1. all my routes and
> 2. the API/WebUI:
> = Routes =
> The existing system has several controllers and thus many routes.
> The old framework used to have classes (controllers) which I used to
> collect logical parts of the API like routes to manage the system,
> routes to manage authentication devices and so on.
> The documentation I read and videos I watched so far gave me the
> impression, that the decorator for routes are rather flat. What way
> would you recommend to summarize certain routes, that belong together?
> I would like to have as few external dependencies as possible.
OK, I guess it might be a way to put those logical units into sub
modules using blueprints as described here...
> = API / WebUI =
> The system has its "own" design. All routes are API calls and a fat
> button. The cool thing about this was, that really every task was
> available as an API call by design.
> not sure, if I could use my API calls in these forms. So I suppose I
> might have to do routes definitions for the API and for the forms:
> @convert_result_for_ui # may be
> def do_something_ui():
> result = lib.do_something()
> return render(result)
> @api.route("/api/dosomething", method=["POST"])
> def do_something_api():
> result = lib.so_something()
> return result
> Do you have any comments on this or are there best practice solutions
> for this in flask?
> I am curious for your comments and eager to get involved with flask.
> Thanks a lot and kind regards