https://github.com/gmihov001/todo-flask-sqlalchemy
Custom Flask API with SQL Alchemy database, to serve a ToDo list front-end project.
https://github.com/gmihov001/todo-flask-sqlalchemy
database flask flask-sqlalchemy mysql python sqlalchemy
Last synced: 3 months ago
JSON representation
Custom Flask API with SQL Alchemy database, to serve a ToDo list front-end project.
- Host: GitHub
- URL: https://github.com/gmihov001/todo-flask-sqlalchemy
- Owner: gmihov001
- Created: 2020-08-20T17:46:11.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-11-01T22:36:13.000Z (over 5 years ago)
- Last Synced: 2026-04-11T13:34:42.833Z (3 months ago)
- Topics: database, flask, flask-sqlalchemy, mysql, python, sqlalchemy
- Language: Python
- Homepage:
- Size: 17.2 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGE_LOG.md
Awesome Lists containing this project
README
# Flask Boilerplate for Profesional Development
[](https://gitpod.io/from-referrer/)
## Features
- Extensive documentation [here](https://github.com/4GeeksAcademy/flask-rest-hello/tree/master/docs).
- Integrated with Pipenv for package managing.
- Fast deloyment to heroku with `$ pipenv run deploy`.
- Use of `.env` file.
- SQLAlchemy integration for database abstraction.
## Installation (automatic if you are using gitpod)
> Important: The boiplerplate is made for python 3.7 but you can easily change the `python_version` on the Pipfile.
The following steps are automatically runned withing gitpod, if you are doing a local installation you have to do them manually:
```sh
pipenv install;
mysql -u root -e "CREATE DATABASE example";
pipenv run init;
pipenv run migrate;
pipenv run upgrade;
```
## How to Start coding?
There is an example API working with an example database. All your application code should be written inside the `./src/` folder.
- src/main.py (it's where your endpoints should be coded)
- src/models.py (your database tables and serialization logic)
- src/utils.py (some reusable classes and functions)
- src/admin.py (add your models to the admin and manage your data easily)
For a more detailed explanation, look for the tutorial inside the `docs` folder.
## Remember to migrate every time you change your models
You have to migrate and upgrade the migrations for every update you make to your models:
```
$ pipenv run migrate (to make the migrations)
$ pipenv run upgrade (to update your databse with the migrations)
```
# Manual Installation for Ubuntu & Mac
⚠️ Make sure you have `python 3.6+` and `MySQL` installed on your computer and MySQL is running, then run the following commands:
```sh
$ pipenv install (to install pip packages)
$ pipenv run migrate (to create the database)
$ pipenv run start (to start the flask webserver)
```
## Deploy to Heroku
This template is 100% compatible with Heroku[https://www.heroku.com/], just make sure to understand and execute the following steps:
```sh
// Install heroku
$ npm i heroku -g
// Login to heroku on the command line
$ heroku login -i
// Create an application (if you don't have it already)
$ heroku create
// Commit and push to heroku (commited your changes)
$ git push heroku master
```
:warning: For a more detailed explanation on working with .env variables or the MySQL database [read the full guide](https://github.com/4GeeksAcademy/flask-rest-hello/blob/master/docs/DEPLOY_YOUR_APP.md).
