# used to endorse or promote products derived from this software without # specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DIRECT, # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # from werkzeug.wsgi import DispatcherMiddleware from spyne.server.wsgi import WsgiApplication from apps import spyned from apps.flasked import app # SOAP services are distinct wsgi applications, we should use dispatcher # middleware to bring all aps together app.wsgi_app = DispatcherMiddleware(app.wsgi_app, { '/soap': WsgiApplication(spyned.create_app(app)) }) if __name__ == '__main__': app.run()
from spyne.server.wsgi import WsgiApplication from werkzeug.middleware.dispatcher import DispatcherMiddleware from apps.flasked import app from apps.soap_app import soap my_apps = { '/trembita': WsgiApplication(soap(app)), } app.wsgi_app = DispatcherMiddleware(app.wsgi_app, my_apps) llevel = logging.DEBUG if app.config.get('DEBUG') else logging.INFO soap_hendler = logging.FileHandler('./logs/standart.log') soap_hendler.setFormatter( logging.Formatter( '[%(asctime)s] [%(process)d] [%(levelname)s] %(name)s: %(message)s')) app.logger.setLevel(llevel) app.logger.addHandler(soap_hendler) logging.getLogger('spyne.protocol.xml').setLevel(llevel) if __name__ == '__main__': app.run( host=app.config.get('APP_HOST'), port=app.config.get('APP_PORT'), )
from werkzeug.wsgi import DispatcherMiddleware from spyne.server.wsgi import WsgiApplication from apps import Service1 from apps.flasked import app app.wsgi_app = DispatcherMiddleware( app.wsgi_app, { '/soapAPI1': WsgiApplication(Service1.create_app(app)), # '/soapAPI2': WsgiApplication(spyned2.create_app(app)) }) if __name__ == '__main__': app.run(host='127.0.0.1', port=8000)
import lxml import gunicorn my_apps = {} my_apps['/DictWage'] = WsgiApplication(soap_get(app)) my_apps['/api'] = WsgiApplication(rest_get(app)) app.wsgi_app = DispatcherMiddleware(app.wsgi_app, my_apps) llevel = logging.DEBUG if app.config.get('DEBUG') else logging.INFO soap_hendler = logging.FileHandler('./logs/standart.log') soap_hendler.setFormatter( logging.Formatter( '[%(asctime)s] [%(process)d] [%(levelname)s] %(name)s: %(message)s')) logger.setLevel(llevel) logger.addHandler(soap_hendler) app.logger.setLevel(llevel) app.logger.addHandler(soap_hendler) logging.getLogger('spyne.protocol.xml').setLevel(llevel) if __name__ == '__main__': app.run(host=app.config.get('APP_HOST'), port=app.config.get('APP_PORT'), threaded=True)