Skip to content

Instantly share code, notes, and snippets.

@xen
Created December 2, 2012 17:41
Show Gist options
  • Save xen/4190101 to your computer and use it in GitHub Desktop.
Save xen/4190101 to your computer and use it in GitHub Desktop.
hopak design
from flask import Flask, render_template
from flask.ext import gear
from flask.ext.pymongo import PyMongo
from formgear.models import Model, ModelRegistry
from formgear.utils import rel
from formgear.ds.mongo import MongoDS
class Post(Model):
__yaml__=rel(__file__, 'post.yaml')
# Create flask app
app = Flask(__name__)
mongo = PyMongo(app)
# Flask views
@app.route('/')
def index():
return '<a href="/gear/">Click me to get to gear!</a>'
if __name__ == '__main__':
# Create gear admin interface
gear = gear.Admin()
gear.add_model(Post)
gear.init_app(app, MongoDS(mongo))
# Start app
app.debug = True
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment