Skip to content
Snippets Groups Projects
Commit 425d1edd authored by furion's avatar furion
Browse files

fix bottle dependencies and imports

parent 0722483e
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os
import json import json
import logging
import os
from datetime import datetime from datetime import datetime
# pylint: disable=import-error, unused-import
import bottle import bottle
from bottle.ext import sqlalchemy
# pylint: enable=import-error
from bottle import request
from bottle import abort from bottle import abort
from bottle_errorsrest import ErrorsRestPlugin from bottle_errorsrest import ErrorsRestPlugin
from bottle_sqlalchemy import Plugin
from sbds.sbds_json import ToStringJSONEncoder
from sbds.server.jsonrpc import register_endpoint
from steem.steemd import Steemd
from hive.core import db_last_block from hive.core import db_last_block
from hive.schema import metadata as hive_metadata from hive.schema import metadata as hive_metadata
from sqlalchemy import create_engine from sqlalchemy import create_engine
from steem.steemd import Steemd
from sbds.sbds_json import ToStringJSONEncoder
from sbds.server.jsonrpc import register_endpoint
import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
app = bottle.Bottle() app = bottle.Bottle()
...@@ -32,10 +28,9 @@ app.config['hive.logger'] = logger ...@@ -32,10 +28,9 @@ app.config['hive.logger'] = logger
def get_db_plugin(database_url): def get_db_plugin(database_url):
sa_engine = create_engine(database_url) sa_engine = create_engine(database_url)
Session.configure(bind=sa_engine)
# pylint: disable=undefined-variable # pylint: disable=undefined-variable
return sqlalchemy.Plugin( return Plugin(
# SQLAlchemy engine created with create_engine function. # SQLAlchemy engine created with create_engine function.
sa_engine, sa_engine,
# SQLAlchemy metadata, required only if create=True. # SQLAlchemy metadata, required only if create=True.
...@@ -46,9 +41,9 @@ def get_db_plugin(database_url): ...@@ -46,9 +41,9 @@ def get_db_plugin(database_url):
create=False, create=False,
# If it is true, plugin commit changes after route is executed (default True). # If it is true, plugin commit changes after route is executed (default True).
commit=False, commit=False,
# If it is true and keyword is not defined, plugin uses **kwargs argument to inject session database (default False). # If True and keyword is not defined, plugin uses **kwargs argument to inject session database (default False).
use_kwargs=False, use_kwargs=False,
create_session=Session) )
app.install( app.install(
...@@ -84,8 +79,6 @@ def health(db): ...@@ -84,8 +79,6 @@ def health(db):
# -------------- # --------------
jsonrpc = register_endpoint(path='/', app=app, namespace='hive') jsonrpc = register_endpoint(path='/', app=app, namespace='hive')
# WSGI application # WSGI application
# ---------------- # ----------------
application = app application = app
......
...@@ -26,11 +26,17 @@ setup( ...@@ -26,11 +26,17 @@ setup(
install_requires=[ install_requires=[
'steem', 'steem',
'maya', 'bottle',
'toolz', 'bottle-sqlalchemy',
'funcy', 'bottle_errorsrest',
'sqlalchemy', 'sqlalchemy',
'mysqlclient', 'mysqlclient',
'click',
'click-spinner',
'funcy',
'toolz',
'maya',
'ujson',
], ],
entry_points={ entry_points={
'console_scripts': [ 'console_scripts': [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment