Skip to content

Instantly share code, notes, and snippets.

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...
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):
python ./manage.py migrate create
Name for the migration: Post
Created new migration file: /mypath/migrations/0002_post.py
python ./manage.py migrate run
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):
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
# "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
# myapp.py
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
# 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'
mkvirtualenv evo;
cdvirtualenv
# this installs flask, flask-script and everything you need
pip install Flask-Evolution
touch myapp.py
touch manage.py