https://github.com/a0s/flask-app-template
Flask app template with migrations and autoloader. One file - one model.
https://github.com/a0s/flask-app-template
Last synced: about 1 month ago
JSON representation
Flask app template with migrations and autoloader. One file - one model.
- Host: GitHub
- URL: https://github.com/a0s/flask-app-template
- Owner: a0s
- License: mit
- Created: 2022-05-07T13:44:36.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-05-08T08:56:15.000Z (about 4 years ago)
- Last Synced: 2025-04-12T06:37:51.821Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# flask-app-template
Flask app template with migrations and autoloader.
Based on Flask-SQLAlchemy and Flask-Migrate.
## How to use
1. Clone the repo
2. Install requirement
```shell
pip install -r requirement.txt
```
3. Init migrations dir
```shell
flask db init
```
4. Generate first migration for User class (`app/models/user.py`) and apply it
```shell
flask db migrate -m "Add User"
flask db upgrade
```
5. Create new class `app/models/product.py`
```python
from . import db
class Product(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(128))
```
Then run `migrate`, `upgrade` and commit changes.