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 oxflask.api
|
|
|
|
|
|
|
|
import settings
|
|
|
|
from settings import db
|
|
|
|
|
|
|
|
import changelog
|
|
|
|
import item.models
|
|
|
|
import user.models
|
|
|
|
import item.person
|
|
|
|
|
|
|
|
import item.api
|
|
|
|
import user.api
|
|
|
|
|
|
|
|
import item.views
|
|
|
|
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
|
|
|
|
app.register_blueprint(oxflask.api.app)
|
|
|
|
app.register_blueprint(item.views.app)
|
|
|
|
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)
|
|
|
|
#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-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')
|
|
|
|
|