This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkvirtualenv micro | |
cdvirtualenv | |
pip install flask bottle web2py web.py kiss.py wheezy.web | |
blah...blah... | |
Successfully installed flask bottle web2py web.py kiss.py wheezy.web Werkzeug Jinja2 gevent compressinja beaker putils jsmin pyScss sqlalchemy elixir jsonpickle pev requests wheezy.core wheezy.caching wheezy.html wheezy.http wheezy.routing wheezy.security wheezy.validation greenlet | |
Cleaning up... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
from flask import current_app | |
from flask.ext.evolution import BaseMigration | |
from flask.ext.sqlalchemy import SQLAlchemy | |
db = SQLAlchemy(current_app) | |
db.metadata.bind = db.engine | |
class Post(db.Model): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python ./manage.py migrate create | |
Name for the migration: Post | |
Created new migration file: /mypath/migrations/0002_post.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python ./manage.py migrate run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
from flask import current_app | |
from flask.ext.evolution import BaseMigration | |
from flask.ext.sqlalchemy import SQLAlchemy | |
db = SQLAlchemy(current_app) | |
db.metadata.bind = db.engine | |
class Post(db.Model): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
from flask import current_app | |
from flask.ext.evolution import BaseMigration | |
from flask.ext.sqlalchemy import SQLAlchemy | |
db = SQLAlchemy(current_app) | |
db.metadata.bind = db.engine | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# "python ./manage.py migrate init" does not create the "migrations" directory for me! | |
mkdir migrations | |
python ./manage.py migrate create | |
Name for the migration: Post | |
Created new migration file: /mypath/migrations/0001_post.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# myapp.py | |
from flask import Flask | |
app = Flask(__name__) | |
@app.route("/") | |
def hello(): | |
return "Hello World!" | |
if __name__ == "__main__": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# manage.py | |
from flaskext.script import Manager | |
from flask.ext.evolution import Evolution | |
from myapp import app | |
manager = Manager(app) | |
evolution = Evolution(app) | |
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkvirtualenv evo; | |
cdvirtualenv | |
# this installs flask, flask-script and everything you need | |
pip install Flask-Evolution | |
touch myapp.py | |
touch manage.py | |