Add a Flask backend to Toga Positron
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 827
- Avg merge
- 9h 45m
- Merged PRs (30d)
- 58
Description
### What is the problem or limitation you are having?
Positron currently provides backends for Django, Static web servers, and single-site web apps.
These options don't help if you have a Flask app that you want to wrap.
### Describe the solution you'd like
Positron should provide a backend for bootstrapping a Flask project.
As with the Django and Static backends, running the bootstrap should produce a viable "Flask hello world". Ideally, that would be in a standalone server.py file, alongside the app.py that defines the Toga app. The Toga app will then start a WSGI server ([`wsgiref`](https://docs.python.org/3/library/wsgiref.html) should be sufficient) that imports and runs `.server:app`.
### Describe alternatives you've considered
Do nothing, and let people write their own Flask apps.
### Additional context
The Django and Static app templates can be used as a starting point; the broad structure of a Flask app will be almost identical, except that it will be starting a `wsgiref` instance rather than a Django or `http.server` instance.
At the same time as implementing the Flask backend, it may be worth considering adding a "bare bones WSGI" implementation - that will be identical to the Flask backend, except that `flask` won't be listed as a dependency, and the `server.py` will be an essentially empty file that the user can put their own WSGI app into.
Contributor guide
Research direction
Start by comparing the existing Django and Static app templates and how their bootstrap process starts a server. The Flask backend should produce a viable hello-world app with app.py and server.py, using wsgiref to import and run .server:app; consider separately whether the optional bare-bones WSGI variant belongs in scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flask, python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100