-
-
Save xen/4190202 to your computer and use it in GitHub Desktop.
hopak design
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
from flask import Flask | |
from flask.ext import hopak | |
from flask.ext.pymongo import PyMongo | |
import models | |
def create_app(): | |
# Create flask app | |
app = Flask(__name__) | |
mongo = PyMongo(app) | |
# Create gear admin interface | |
hpa = hopak.Admin() | |
hpa.add_model(models.Post) | |
hpa.init_app(app, ds=mongo) | |
return app | |
app = create_app() |
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
from app import app | |
if __name__ == '__main__': | |
app.debug = True | |
app.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
from hopak import Model, rel | |
class Post(Model): | |
__yaml__=rel(__file__, 'post.yaml') |
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
from app import app | |
# Flask views | |
@app.route('/') | |
def index(): | |
return '<a href="/gear/">Click me to get to gear!</a>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment