Ejemplo n.º 1
0
def create_app():
    app = Flask(__name__)
    app.debug = True
    app.secret_key = "development key"
    app_ctx = app.app_context()
    app_ctx.push()
    current_app.config["FLASK_COUNT_PER_PAGE"] = 8
    bootstrap.init_app(app)
    MyDataBase.app = app
    MyDataBase.init_db()
    from route import main as main_blue_print

    app.register_blueprint(main_blue_print)
    return app
Ejemplo n.º 2
0
#!/usr/bin/env python3
# coding=utf-8
# Created Time: 2015-11-09

from db import MyDataBase

db = MyDataBase.get_db()

class GrowRecord(db.Model):
	id = db.Column(db.Integer, primary_key=True)
	event = db.Column(db.String(80))
	date = db.Column(db.DateTime)
	extra_text = db.Column(db.Text)

	def __init__(self, event, date, extra_text):
		self.event = event
		self.date = date
		self.extra_text = extra_text

	def __repr__(self):
		return "Event {0.event}, DateTime {0.date}, extra_text {0.extra_text}".format(self)



class Diary(db.Model):
	id = db.Column(db.Integer, primary_key=True)
	date = db.Column(db.DateTime)
	text = db.Column(db.Text)
	tags = db.Column(db.String(80))

	def __init__(self, date, text, tags):