Commit 21dcb503 by David Guillot

Ajout de Flask-Migrate

parent 0bcc8927
......@@ -5,3 +5,4 @@
data/*.json
data/*.zip
reference
/migrations/
......@@ -43,6 +43,25 @@ $ parlapi update_amo_an
$ parlapi runserver
```
### Mise à jour d'une installation existante
ParlAPI utilise [Flask-Migrate](https://github.com/miguelgrinberg/Flask-Migrate) pour gérer les migrations de base de données.
#### Installation sur une instance existante
```bash
pip install -e .
export FLASK_APP=parlapi/parlapi.py
flask db init
```
#### Usage
```bash
export FLASK_APP=parlapi/parlapi.py
flask db upgrade
```
### Déploiement Openshift
```bash
......
......@@ -4,6 +4,7 @@ import os
from flask import Flask
from flaskext.markdown import Markdown
from flask_migrate import Migrate
def setup_app(name):
......@@ -19,6 +20,8 @@ def setup_app(name):
from .models import db
db.init_app(app)
migrate = Migrate(app, db)
# Setup REST API
from .rest.setup import setup_an_api as setup_an_rest_api
an_rest_api = setup_an_rest_api(app)
......
......@@ -37,6 +37,7 @@ setup(
'pycparser==2.13', # 2.14 has CFFI bug
'requests>=2.10,<3',
'sqlalchemy-searchable>=0.10,<1',
'Flask-Migrate>=2.0,<3',
],
classifiers=[
"Development Status :: 3 - Alpha",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment