Rearrange source into something resembling a package

This commit is contained in:
Danny Robson 2020-06-09 14:49:58 +10:00
parent b7e9d6a351
commit 13e1f7650a
7 changed files with 8 additions and 2 deletions

View File

@ -122,7 +122,7 @@ if __name__ == '__main__':
args = parser.parse_args() args = parser.parse_args()
dirname = os.path.dirname(os.path.realpath(__file__)) dirname = os.path.dirname(os.path.realpath(__file__))
dbpath = os.path.realpath(os.path.join(dirname, '..', 'db', 'data.sqlite')) dbpath = os.path.realpath(os.path.join(dirname, '..', '..', 'db', 'data.sqlite'))
db = sa.create_engine(f"sqlite:///{dbpath}") db = sa.create_engine(f"sqlite:///{dbpath}")
session = sa.orm.Session(db) session = sa.orm.Session(db)

View File

View File

@ -36,7 +36,6 @@ DBSession = sqlalchemy.orm.scoped_session(
def init_model(engine): def init_model(engine):
DBSession.configure(bind=engine) DBSession.configure(bind=engine)
config.update_blueprint({ config.update_blueprint({
'model': tg.util.Bunch( 'model': tg.util.Bunch(
DBSession=DBSession, DBSession=DBSession,
@ -44,6 +43,13 @@ config.update_blueprint({
) )
}) })
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
import edible_elephant.db
application = config.make_wsgi_app() application = config.make_wsgi_app()
import wsgiref.simple_server import wsgiref.simple_server

View File