Skip to main content

Create desktop applications with Flask (or Django)!

Project description

Create desktop applications with Flask (or Django)!

Downloads

Install

pip install flaskwebgui

Or download source file flaskwebgui.py and place it where you need.

Usage with Flask

Check this video!

from flask import Flask
from flaskwebgui import FlaskUI #get the FlaskUI class

app = Flask(__name__)

# Feed it the flask app instance 
ui = FlaskUI(app)

# do your logic as usual in Flask
@app.route("/")
def index():
return "It works!"

# call the 'run' method
ui.run()

Usage with Django

Make a file 'gui.py'(file name not important) next to 'manage.py' file in the django project folder.

Inside 'gui.py' file add these 2 lines of code:


from flaskwebgui import FlaskUI #import FlaskUI class

#You can also call the run function on FlaskUI class instantiation

FlaskUI(server='django').run()

Next run from your terminal the bellow command:

python gui.py

Configurations

Default FlaskUI class parameters:

  • app, ==> flask class instance

  • width=800 ==> default width 800

  • height=600 ==> default height 600

  • fullscreen=False ==> start app in fullscreen

  • maximized=False ==> start app in maximized window

  • app_mode=True ==> by default it will start chrome in app(desktop) mode without address bar

  • browser_path="" ==> path to browser.exe (can be absoluteC:/browser_folder/chrome.exe or relative chromium.exe) - if not specified, the app will run in development mode and all running Chrome processes will be killed. To avoid this behaviour, put portable Chromium *.exe file in the app directory and specify a path to it.

  • server="flask" ==> the default backend framework is flask (django is suported also), but you can add a function which starts the desired server for your choosed framework (bottle, web2py pyramid etc)

  • host="127.0.0.1" ==> specify other if needed

  • port=5000 ==> specify other if needed

  • socketio=SocketIO Instance ==> Flask SocketIO instance (if specified, uses socketio.run() instead of app.run() for Flask application)

Should work on windows/linux/mac with no isssues.

If browser is not found, this would be quick fix: FlaskUI (app, browser_path=r"path/to/chrome.exe")

The recommended way of using flaskwebgui

  • Download portable Chromium for the your targeted os,
  • Place the extracted portable app next to main.py file,
  • Specify the browser_path parameter.

In this way when you distribute it, you don't need users to have chrome installed, it will work like a portable app.

Also, during development of your app do that in the normal way you do a Flask app without flaskwebgui. Use flaskwebgui only when you are finished the app (test the app) and ready to deploy.

flaskwebgui doesn't interfere with your way of doing a flask application it just helps converting it into a desktop app more easily with pyinstaller or pyvan.

Distribution

You can distribute it as a standalone desktop app with pyinstaller or pyvan.

Credits

It's a combination of https://github.com/Widdershin/flask-desktop and https://github.com/ChrisKnott/Eel

flaskwebgui just uses threading to start a flask server and the browser in app mode (for chrome). It has some advantages over flask-desktop because it doesn't use PyQt5, so you won't have any issues regarding licensing and over Eel because you don't need to learn any logic other than Flask.

Submit any questions/issues you have! Fell free to fork it and improve it!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flaskwebgui-0.1.8.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flaskwebgui-0.1.8-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file flaskwebgui-0.1.8.tar.gz.

File metadata

  • Download URL: flaskwebgui-0.1.8.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9

File hashes

Hashes for flaskwebgui-0.1.8.tar.gz
Algorithm Hash digest
SHA256 282da78124412b58d4e23a6115cc5c4ba74cfe828ca9a84395be36db954d1fd6
MD5 57f9871cb212674ce6c4924a656620b9
BLAKE2b-256 b8050dce159f41794ea0ac2b0801e68d58dc9793588f60a22cd975f4db33ed4f

See more details on using hashes here.

File details

Details for the file flaskwebgui-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: flaskwebgui-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9

File hashes

Hashes for flaskwebgui-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 0117ae72ea301cf0fce5d14e14958ad4d73214d0daf2e32789ec6a91a0dea91a
MD5 b66e98581b8f1fa987cea32346949b54
BLAKE2b-256 50db005591579e1f145b3907146416dd6f90b47ff8044205526472ef7832fb25

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page