Packaging uwsgi flask app for non-programmers?

Israel Brewster israel at ravnalaska.net
Tue Feb 13 12:28:47 EST 2018


> 
> On Feb 6, 2018, at 12:12 PM, Israel Brewster <israel at ravnalaska.net> wrote:
> 
> 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".
> 
> The problem is that in order for this to work, the end user must:
> 
> 1) Install python 3.6 (or thereabouts)
> 2) Install a number of python modules, and
> 3) run a command line (from the appropriate directory)
> 
> 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?

So at the moment, since there have been no suggestions for packaging, I'm getting by with a bash script that:

a) Makes sure python 3 is installed, prompting the user to install it if not
b) Makes sure pip and virtualenv are installed, and installs them if needed
c) Sets up a virtualenv in the distribution directory
d) Installs all needed modules in the virtualenv - this step requires that dev tools are installed, a separate install.
e) modifies the configuration files to match the user and directory, and 
f) Installs a launchd script to run the uwsgi application

This actually seems to work fairly well, and by giving the script a .command extension, which automatically gets associated with terminal under OS X, the end user can simply double-click setup.command without having to go into terminal themselves. The main stumbling block then is the install of python3 - the user still has to manually download and install it in addition to my code, which I'd prefer to avoid - having to install my code separate from the Alexa skill is already an annoyance. As such, I'm considering three possible solutions:

1) Make some sort of installer package that includes the python3 installer
2) Somehow automate the download and install of Python3, or
3) re-write my code to be python 2 compatible (since python 2 is included with the OS)

If anyone has any suggestions on how I could accomplish 1 or 2, I'd appreciate it. Thanks!

-----------------------------------------------
Israel Brewster
Systems Analyst II
Ravn Alaska
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7293
-----------------------------------------------

> 
> -----------------------------------------------
> Israel Brewster
> Systems Analyst II
> Ravn Alaska
> 5245 Airport Industrial Rd
> Fairbanks, AK 99709
> (907) 450-7293
> -----------------------------------------------
> 
> 
> 
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list