sideshow-corepos/src/sideshow_corepos/web/app.py
2025-01-13 09:19:03 -06:00

68 lines
2 KiB
Python

# -*- coding: utf-8; -*-
################################################################################
#
# Sideshow-COREPOS -- Case/Special Order Tracker for CORE-POS
# Copyright © 2025 Lance Edgar
#
# This file is part of Sideshow.
#
# Sideshow is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Sideshow is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Sideshow. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
"""
Sideshow-COREPOS web app
"""
from wuttaweb import app as base
from wutta_corepos.web.db import CoreOpSession
def main(global_config, **settings):
"""
Make and return the WSGI app (Paste entry point).
"""
# prefer Sideshow templates over wuttaweb
settings.setdefault('mako.directories', [
'sideshow.web:templates',
'wuttaweb:templates',
])
# make config objects
wutta_config = base.make_wutta_config(settings)
pyramid_config = base.make_pyramid_config(settings)
# configure DB sessions
CoreOpSession.configure(bind=wutta_config.core_office_op_engine)
# bring in the rest of Sideshow
pyramid_config.include('sideshow.web')
pyramid_config.include('sideshow_corepos.web')
return pyramid_config.make_wsgi_app()
def make_wsgi_app():
"""
Make and return the WSGI app (generic entry point).
"""
return base.make_wsgi_app(main)
def make_asgi_app():
"""
Make and return the ASGI app (generic entry point).
"""
return base.make_asgi_app(main)