5

I built a small web app for a friend. That friend's computer will not be connected to the Internet when using the app, so deploying it on Heroku is not an option.

Is there a way to deploy it locally without having to install a complex web server? Something small that can be packaged with the application? Using the built-in Flask server seems to be discouraged when you go to "production", but for a local app is it ok?

davidism
  • 121,510
  • 29
  • 395
  • 339
Kinwolf
  • 755
  • 2
  • 14
  • 24
  • 1
    Without knowing what the application does, it's hard to say if the development server would be sufficient. One of its limitations is that it's single-threaded. Does your application ever need to handle more than process at a time? – dirn Apr 29 '15 at 15:52
  • No, it's a simple zumba class management application. She'll use it to manage membership, members "punchcard" and registering class participants. And since only one person will be on it, there is no real need for a database server like mysql. So only the webserver requisite is causing me problem right now. – Kinwolf Apr 29 '15 at 16:03

2 Answers2

4

If you're just running the app locally, it should be fine. The main issues with the dev server are security and performance, but for an app that's not exposed to the outside and that has a single user, it should work fine. Even though you're using the dev server, it's still a good idea to turn off debug mode and enable multiprocess mode.

from multiprocessing import cpu_count
app.run(debug=False, processes=cpu_count())

If you want a little more performance, consider using uwsgi or gunicorn. Both are good WSGI app servers that can be installed with pip along with your application.

gunicorn -w $(nproc) --threads 2 --max-requests 10 myproject:app
davidism
  • 121,510
  • 29
  • 395
  • 339
4

If it's just going to be used offline by one person, then yes, the internal development server might be sufficient.

If you're looking for a simple way to send that app to her, then see pyinstaller:

pip install pyinstaller
pyinstaller your_app.py

Zip up the folder inside the new dist directory and pass that along.

If pyinstaller isn't for you, there are plenty of options.

Community
  • 1
  • 1
Celeo
  • 5,583
  • 8
  • 39
  • 41