Kivy App with Flask Example
This is a template application that shows how Flask and Kivy can work together. This example runs on Android. It starts Flask in a background thread and logs incoming requests to a text output on the Android screen.
ALso see these relevant tutorials:
- Kivy Flask App on Android Example - More details and instructions about this project
- Python Flask Tutorial
- Kivy Tutorial
- How to Publish Android Apps to Google Play Store
- PyInstaller Tutorial - For packaging desktop apps as .exe and Linux/Mac equivalents
You need Kivy and Buildozer. You must be on Linux for Android build to work.
python3 -m pip install kivy buildozer
Build, install, and run
Use buildozer to create Android APKs, deploy, and run.
# Build python3 -m buildozer android debug # Build and install python3 -m buildozer android debug deploy # Build, install, and run python3 -m buildozer android debug deploy run # Build, install, and run with log output python3 -m buildozer android debug deploy run logcat
Get the IP address of the device
python3 -m buildozer -v android adb -- shell ifconfig wlan0
Run curl from Android
curl from the Android device can be useful for testing Flask.
python3 -m buildozer -v android adb -- shell "curl localhost:5000"