osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Packaging uwsgi flask app for non-programmers?




> On Feb 6, 2018, at 8:24 PM, Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
> 
> On Tue, 6 Feb 2018 12:12:26 -0900, Israel Brewster <israel at ravnalaska.net>
> declaimed the following:
> 
>> I have been working on writing an Alexa skill which, as part of it, requires a local web server on the end users machine - the Alexa skill sends commands to this server, which runs them on the local machine. I wrote this local server in Flask, and run it using uwsgi, using a command like: "uwsgi serverconfig.ini".
>> 
> 
> 	<SNIP>
> 
>> Not terribly difficult, but when I think of my target audience (Alexa users), I could easily see even these steps being "too complicated". I was looking at pyinstaller to create a simple double-click application, but it appears that pyinstaller needs a python script as the "base" for the application, whereas my "base" is uwsgi. Also, I do need to leave a config file accessible for the end user to be able to edit. Is there a way to use pyinstaller in this scenario, or perhaps some other option that might work better to package things up?
> 
> 	Not mentioned is getting your end-user to possibly have to open up
> fire-wall rules to allow INBOUND connections (even if, somehow, limited to
> LAN -- don't want to leave a WAN port open).

Not mentioned because it's not needed - I establish a ngrok tunnel to provide external https access to the local server. I just include the ngrok binary with my package, and run it using subprocess.Popen. Since it doesn't even require you to have an account to use it, that bypasses the need to set up port-forwards and firewall rules quite nicely. Also solves the problem of dynamic IP's without having to burden the end user with dyndns or the like - I just "register" the URL you get when connecting. Admittedly though, that was a large concern of mine until I was pointed to ngrok as a solution.

Ideally, I'd just access across the local network, Alexa device to local machine, but that's not an option - at least, not yet.

> -- 
> 	Wulfraed                 Dennis Lee Bieber         AF6VN
>    wlfraed at ix.netcom.com    HTTP://wlfraed.home.netcom.com/
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list