Hi David,

I don't know all of your constraints, but a migration architecture that has
worked pretty well for our migration from Twisted (WebSockets) + Flask
(REST/JSON API) to aiohttp:

   1. Avoid to mix the async and sync in the same daemon, to avoid that
   sync blocks async event loop, even if it's technically possible to mitigate
   the sync blocking via threads.

   2. Put an HTTP reverse proxy behind your application: If you have Flask,
   you certainly have an Apache or Nginx as reverse proxy to serve static
   files. In our case, we have used HAProxy.

   3. Configure your HTTP reverse proxy to serve between your two daemons,
   depends on the URI.

   4. With that, you can keep your Flask application on 3.6, and use for
   example aiohttp for WebSockets.

   5. If one moment you want to have an all-in-one daemon like us to share
   easily your business logic code between HTTP and WebSockets, you can easily
   port endpoint by endpoint your code:
   With the reverse proxy, it's pretty easy to decide that daemon will
   serve an HTTP request, and in case of regression, easy to rollback with
   Flask, the time to fix your portage.

   6. The porting has very easy to us, mainly because the aiohttp server
   API looks like Flask, and aiohttp client API looks like Requests.

Regards.

--
Ludovic Gasc (GMLudo)
Lead Developer Architect at ALLOcloud
https://be.linkedin.com/in/ludovicgasc

2017-07-17 7:57 GMT+02:00 David Montgomery <davidmontgom...@gmail.com>:

>
> Hi,
>
> I have used flask/bottle with nginx/uWSGI gevent loop with great success
> for 2.7
>
> Its now time for me to move on up to 3.6
>
> I see that uWSGI supports asyncio but does not appear that the use of
> asyncio with flask is heavily supported by the community
>
> What are the python 3.6 frameworks as closest top flask as possible that
> will use uWSGI asyncio?  e.g. aiohttp? sanic?
>
> what is the uWSGI python that needs asyncio with 3.x using for a framework?
>
> It appears that I can still use gevent with flask with python 3 but this
> is a monkey patch to force async wherase asyncio is native
>
> Thanks
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> uWSGI mailing list
> uWSGI@lists.unbit.it
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>
>
_______________________________________________
uWSGI mailing list
uWSGI@lists.unbit.it
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to