|
|
@ -49,9 +49,9 @@ def close_database(exception): |
|
|
|
top.sqlite_db.close() |
|
|
|
top.sqlite_db.close() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def init_db(): |
|
|
|
@app.cli.command() |
|
|
|
|
|
|
|
def initdb(): |
|
|
|
"""Creates the database tables.""" |
|
|
|
"""Creates the database tables.""" |
|
|
|
with app.app_context(): |
|
|
|
|
|
|
|
db = get_db() |
|
|
|
db = get_db() |
|
|
|
with app.open_resource('schema.sql', mode='r') as f: |
|
|
|
with app.open_resource('schema.sql', mode='r') as f: |
|
|
|
db.cursor().executescript(f.read()) |
|
|
|
db.cursor().executescript(f.read()) |
|
|
@ -248,8 +248,3 @@ def logout(): |
|
|
|
# add some filters to jinja |
|
|
|
# add some filters to jinja |
|
|
|
app.jinja_env.filters['datetimeformat'] = format_datetime |
|
|
|
app.jinja_env.filters['datetimeformat'] = format_datetime |
|
|
|
app.jinja_env.filters['gravatar'] = gravatar_url |
|
|
|
app.jinja_env.filters['gravatar'] = gravatar_url |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
|
|
|
|
init_db() |
|
|
|
|
|
|
|
app.run() |
|
|
|
|
|
|
|