-
-
Save xen/4190257 to your computer and use it in GitHub Desktop.
hopak design
This file contains hidden or 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.hopak import Admin # Serduchka's danzing nao | |
from flask.ext.pymongo import PyMongo | |
import models | |
def create_app(): | |
# Create flask app | |
app = Flask(__name__) | |
mongo = PyMongo(app) | |
# Create admin interface | |
hp = Admin() | |
hp.add_model(models.Post) | |
hp.init_app(app, ds=mongo) | |
return app | |
app = create_app() |
This file contains hidden or 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 hidden or 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 hidden or 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