import socket import wof from pyhis_dao import PyhisDao logging.basicConfig(level=logging.DEBUG) if socket.gethostname() == "Midgewater": DEPLOYED = True else: DEPLOYED = False APP_NAME = "tceq" if DEPLOYED: DEPLOYMENT_DIR = "/space/www/wofpy_deployments/%s_deployment" % APP_NAME else: DEPLOYMENT_DIR = os.path.abspath("../") CACHE_DIR = os.path.join(DEPLOYMENT_DIR, "cache/") CONFIG_FILE = os.path.join(DEPLOYMENT_DIR, APP_NAME + "_config.cfg") DATABASE_URI = "sqlite:////" + os.path.join(CACHE_DIR, APP_NAME + "_pyhis_cache.db") app_dao = PyhisDao(DATABASE_URI, CONFIG_FILE) app = wof.create_wof_app(app_dao, CONFIG_FILE) if __name__ == "__main__": app.run(host="0.0.0.0", port=8080, threaded=True)
import soaplib import logging import wof from csv_dao import CsvDao CSV_CONFIG_FILE = 'csv_config.cfg' SITES_FILE = 'sites.csv' VALUES_FILE = 'data.csv' logging.basicConfig(level=logging.DEBUG) #dao = CsvDao(SITES_FILE, VALUES_FILE) dao = CsvDao(SITES_FILE) app = wof.create_wof_app(dao, CSV_CONFIG_FILE) app.config['DEBUG'] = True if __name__ == '__main__': # This must be an available port on your computer. # For example, if 8080 is already being used, try another port such as # 5000 or 8081. openPort = 8080 url = "http://127.0.0.1:" + str(openPort) + "/" print "----------------------------------------------------------------" print "Access 'REST' endpoints at " + url print "Access SOAP WSDL at " + url + "soap/wateroneflow.wsdl" print "----------------------------------------------------------------"
import soaplib import logging import wof from csv_dao import CsvDao CSV_CONFIG_FILE = 'csv_config.cfg' SITES_FILE = 'sites.csv' VALUES_FILE = 'data.csv' logging.basicConfig(level=logging.DEBUG) dao = CsvDao(SITES_FILE, VALUES_FILE) app = wof.create_wof_app(dao, CSV_CONFIG_FILE) app.config['DEBUG'] = True if __name__ == '__main__': print "----------------------------------------------------------------" print "Access 'REST' endpoints at http://127.0.0.1:8080/" print "Access SOAP WSDL at http://127.0.0.1:8080/soap/wateroneflow.wsdl" print "----------------------------------------------------------------" app.run(host='0.0.0.0', port=8080, threaded=True)
import soaplib import logging import wof from swis_dao import SwisDao SWIS_DATABASE_URI = 'sqlite:///swis2.db' SWIS_CONFIG_FILE = 'swis_config.cfg' logging.basicConfig(level=logging.DEBUG) swis_dao = SwisDao(SWIS_CONFIG_FILE, database_uri=SWIS_DATABASE_URI) app = wof.create_wof_app(swis_dao, SWIS_CONFIG_FILE) app.config['DEBUG'] = True if __name__ == '__main__': print "-----------------------------------------------------------------" print "Access 'REST' endpoints at http://127.0.0.1:8080/" print "Access SOAP WSDLs at http://127.0.0.1:8080/soap/wateroneflow.wsdl" print "-----------------------------------------------------------------" app.run(host='0.0.0.0', port=8080, threaded=True)
import logging import os import tempfile import wof from cbi_dao import CbiDao # change the cache dir if you are going to deploy this in production CBI_CACHE_DIR = tempfile.gettempdir() CBI_CONFIG_FILE = 'cbi_config.cfg' CBI_CACHE_DATABASE_URI = 'sqlite:///' + os.path.join(CBI_CACHE_DIR, 'cbi_dao_cache.db') logging.basicConfig(level=logging.DEBUG) cbi_dao = CbiDao(CBI_CONFIG_FILE, database_uri=CBI_CACHE_DATABASE_URI) app = wof.create_wof_app(cbi_dao, CBI_CONFIG_FILE) app.config['DEBUG'] = True if __name__ == '__main__': print "-----------------------------------------------------------------" print "Access 'REST' endpoints at http://127.0.0.1:8080/" print "Access SOAP WSDLs at http://127.0.0.1:8080/soap/wateroneflow.wsdl" print "-----------------------------------------------------------------" print CBI_CACHE_DATABASE_URI app.run(host='0.0.0.0', port=8080, threaded=True)
import wof from odm_dao import OdmDao import private_config """ Before running this script, create a private_config.py file with the connection string to your ODM database in SQL Server. For example: lbr_connection_string = \ 'mssql+pyodbc://username:password@(local)/LittleBear11' """ logging.basicConfig(level=logging.DEBUG) dao = OdmDao(private_config.lbr_connection_string) app = wof.create_wof_app(dao, 'lbr_config.cfg') app.config['DEBUG'] = True if __name__ == '__main__': # This must be an available port on your computer. # For example, if 8080 is already being used, try another port such as # 5000 or 8081. openPort = 8080 url = "http://127.0.0.1:" + str(openPort) + "/" print "----------------------------------------------------------------" print "Access 'REST' endpoints at " + url print "Access SOAP WSDL at " + url + "soap/wateroneflow.wsdl" print "----------------------------------------------------------------"
def create_app(): test_dao = TestDao() app = wof.create_wof_app(test_dao, 'test_config.cfg') app.config['DEBUG'] = True
import wof from cbi_dao import CbiDao if socket.gethostname() == 'Midgewater': DEPLOYED = True else: DEPLOYED = False if DEPLOYED: CBI_DEPLOYMENT_DIR = '/space/www/wofpy_deployments/cbi_deployment' CBI_CACHE_DIR = os.path.join(CBI_DEPLOYMENT_DIR, 'cache/') CBI_CONFIG_FILE = os.path.join(CBI_DEPLOYMENT_DIR, 'cbi_config.cfg') else: CBI_DEPLOYMENT_DIR = './' CBI_CACHE_DIR = tempfile.gettempdir() CBI_CONFIG_FILE = 'cbi_config.cfg' CBI_CACHE_DATABASE_URI = 'sqlite:////' + os.path.join( CBI_CACHE_DIR, 'cbi_dao_cache.db') logging.basicConfig(level=logging.DEBUG) cbi_dao = CbiDao(CBI_CONFIG_FILE, database_uri=CBI_CACHE_DATABASE_URI) app = wof.create_wof_app(cbi_dao, CBI_CONFIG_FILE) if not DEPLOYED: app.run()
import soaplib import logging import wof from odm_dao import OdmDao import private_config logging.basicConfig(level=logging.DEBUG) dao = OdmDao(private_config.lbr_connection_string) app = wof.create_wof_app(dao, 'lbr_config.cfg') app.config['DEBUG'] = True if __name__ == '__main__': print "-----------------------------------------------------------------" print "Access 'REST' endpoints at http://127.0.0.1:8080/" print "Access SOAP WSDLs at http://127.0.0.1:8080/soap/wateroneflow.wsdl" print "-----------------------------------------------------------------" app.run(host='0.0.0.0', port=8080, threaded=True)
import soaplib import logging import wof from swis_dao import SwisDao SWIS_DATABASE_URI = 'sqlite:///swis2.db' SWIS_CONFIG_FILE = 'swis_config.cfg' logging.basicConfig(level=logging.DEBUG) swis_dao = SwisDao(SWIS_CONFIG_FILE, database_uri=SWIS_DATABASE_URI) app = wof.create_wof_app(swis_dao, SWIS_CONFIG_FILE) app.config['DEBUG'] = True if __name__ == '__main__': # This must be an available port on your computer. # For example, if 8080 is already being used, try another port such as # 5000 or 8081. openPort = 8080 url = "http://127.0.0.1:" + str(openPort) + "/" print "----------------------------------------------------------------" print "Access 'REST' endpoints at " + url print "Access SOAP WSDL at " + url + "soap/wateroneflow.wsdl" print "----------------------------------------------------------------" app.run(host='0.0.0.0', port=openPort, threaded=True)
import soaplib import logging import wof from odm_dao import OdmDao import private_config logging.basicConfig(level=logging.DEBUG) dao = OdmDao(private_config.sara_connection_string) app = wof.create_wof_app(swis_dao, 'sara_config.cfg') app.config['DEBUG'] = True if __name__ == '__main__': # This must be an available port on your computer. # For example, if 8080 is already being used, try another port such as # 5000 or 8081. openPort = 8080 url = "http://127.0.0.1:" + str(openPort) + "/" print "----------------------------------------------------------------" print "Access 'REST' endpoints at " + url print "Access SOAP WSDL at " + url + "soap/wateroneflow.wsdl" print "----------------------------------------------------------------" app.run(host='0.0.0.0', port=openPort, threaded=True)
import soaplib import logging import wof from odm_dao import OdmDao import private_config logging.basicConfig(level=logging.DEBUG) dao = OdmDao(private_config.sara_connection_string) app = wof.create_wof_app(swis_dao, 'sara_config.cfg') app.config['DEBUG'] = True if __name__ == '__main__': app.run(host='0.0.0.0', port=8080, threaded=True)