This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

adding mongokit

  • Loading branch information...
suzuken committed Oct 9, 2012
1 parent fba1f7f commit 728381cd57a740f8ddf572ce977420c76df76870
Showing with 43 additions and 0 deletions.
  1. +10 −0 README.md
  2. +33 −0 blog.py
View
@@ -1,3 +1,13 @@
# livecoding
MicroBlogつくります!
## schema
* Post
* title, body, author, datetime
## TODO
* Userのドキュメントもつくる
View
33 blog.py
@@ -1,5 +1,38 @@
#!/usr/bin/env python
from flask import Flask
from mongokit import Connection, Document
DEBUG = True
# configuration
MONGODB_HOST = 'localhost'
MONGODB_PORT = 27017
app = Flask(__name__)
app.config.from_object(__name__)
connection = Connection(
app.config['MONGODB_HOST'],
app.config['MONGODB_PORT']
)
class Post(object):
structure = {
'name': unicode,
'email': unicode,
}
validators = {
'name': max_length(50),
'email': max_length(120)
}
use_dot_notation = True
def __repr__(self):
return '<User %r>' % (self.name)
@app.route('/')
def index():
return "hello"
if __name__ == '__main__':
app.run()

0 comments on commit 728381c

Please sign in to comment.