Example project demonstrating the CRUD paradigm on top of the branches and files in a Github repository, built with Flask. This project implements the same CRUD pattern using a Rest API and using a web application.
- how to deliver the same features in both API endpoints and static html forms in one Flask project
- how Flask can be used with the MVC design pattern with the controller imported as Flask blueprints
- how Flask can deal with Github integration using the Github API v3 (used as the model "persistence" layer in the MVC design pattern)
- API endpoint pytest testing with importing the app factory
- ability of such a web application to gracefully fail on Github integration exceptions
- how easy it is to integrate a Flask web application with Bootstrap used for styling
git clone
this repo- setup a virtual environment for this project
- create a Github personal access token: login to Github and go to settings --> developer settings --> Personal access tokens --> Generate a new token
- generate a random flask secret app key
- setup your environment variables like:
github_token = <your github token value>
flask_secret_key = <your generated flask secret key>
- setup your github repository name, the "files playground" folder and other settings in
flaskr/project_variables/settings.py
- your startup configuration should look something like this:
disclaimer: this example project codebase comes as is, in a production ready application, besides other things, you should use the OAuth protocol for the Github login, this library can get you started: https://github-flask.readthedocs.io/en/latest/