openmedialibrary/oml/app.py

54 lines
1.4 KiB
Python
Raw Normal View History

2014-05-04 17:26:43 +00:00
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
2014-05-16 08:06:11 +00:00
from __future__ import division
2014-05-04 17:26:43 +00:00
from flask import Flask
2014-05-17 21:40:34 +00:00
from flask.ext.script import Manager, Shell
2014-05-04 17:26:43 +00:00
from flask.ext.migrate import Migrate, MigrateCommand
2014-05-17 14:26:59 +00:00
import logging
2014-05-04 17:26:43 +00:00
import settings
from settings import db
import changelog
import item.models
import user.models
import item.person
2014-05-18 23:24:04 +00:00
import api
2014-05-04 17:26:43 +00:00
import commands
2014-05-17 14:26:59 +00:00
#FORMAT = '%(asctime)-15s %(clientip)s %(user)-8s %(message)s'
#logging.basicConfig(format=FORMAT)
#logger = logging.getLogger('oml.app')
#logger.warning('test')
logging.basicConfig(level=logging.DEBUG)
2014-05-04 17:26:43 +00:00
app = Flask('openmedialibrary', static_folder=settings.static_path)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////%s' % settings.db_path
db.init_app(app)
migrate = Migrate(app, db)
2014-05-17 21:40:34 +00:00
manager = Manager(app, with_default_commands=False)
2014-05-04 17:26:43 +00:00
manager.add_command('db', MigrateCommand)
2014-05-17 21:40:34 +00:00
manager.add_command('release', commands.Release)
manager.add_command('debug', commands.Debug)
2014-05-17 22:32:08 +00:00
manager.add_command('update', commands.Update)
2014-05-17 21:40:34 +00:00
#manager.add_command('start', commands.Start)
#manager.add_command('stop', commands.Stop)
2014-05-04 17:26:43 +00:00
manager.add_command('setup', commands.Setup)
2014-05-20 00:08:28 +00:00
manager.add_command('version', commands.Version)
manager.add_command('postupdate', commands.PostUpdate)
2014-05-17 21:40:34 +00:00
manager.add_command('shell', Shell)
2014-05-04 17:26:43 +00:00
manager.add_command('update_static', commands.UpdateStatic)
@app.route('/')
@app.route('/<path:path>')
def main(path=None):
return app.send_static_file('html/oml.html')