def main(): args = parser.parse_args() cfg.merge_from_file(args.cfg) cfg.merge_from_list(args.opts) cfg.RUNTIME.gpu = args.gpu logger = setup_logger(distributed_rank=0) logger.info("Loaded configuration file {}".format(args.cfg)) logger.info("Running with config:\n{}".format(cfg)) cfg.MODEL.arch_encoder = cfg.MODEL.arch_encoder.lower() cfg.MODEL.arch_decoder = cfg.MODEL.arch_decoder.lower() # absolute paths of model weights cfg.MODEL.weights_encoder = os.path.join(cfg.DIR, 'encoder_' + cfg.TEST.checkpoint) cfg.MODEL.weights_decoder = os.path.join(cfg.DIR, 'decoder_' + cfg.TEST.checkpoint) assert os.path.exists(cfg.MODEL.weights_encoder) and \ os.path.exists(cfg.MODEL.weights_decoder), "checkpoint does not exitst!" server.app.processor = SegmentationProcessor(cfg) with server.app.processor: app.run(host=args.host, port=args.port)
def start(): try: context = ('hotscreen.crt', 'hotscreen.key') app.run(host='0.0.0.0', port=5000, debug=False) except Exception: print('Could not start server') raise
def main(): log.info("Loading .env...") load_dotenv() log.info("Creating application ...") app = server.app.create_app( { "/_healthz": healthz.handler, "/_metrics": metrics.handler, "/example_tasks": tasks.create_handler( worker.tasks.example_task, worker.util, ), }, { 404: not_found.handler, 405: not_allowed.handler, }) log.info("Starting server ...") if os.getenv("ENV") == "dev": app.run( debug=True, host='0.0.0.0', port=int(os.getenv("PORT")), ) else: serve( app, host="0.0.0.0", port=int(os.getenv("PORT")), _quiet=True, )
def server(frame_buffers, admin_queue, inf_ready_queue, api_results): # Start running the server to listen the requests from the frontend from server import app, init init(api_results, ALL_MODELS, frame_buffers, admin_queue, inf_ready_queue) inf_ready_queue.get() while True: app.run(debug=False, host="0.0.0.0")
def runserver(host, port, workers, debug, cors): from server import app if cors: from sanic_cors import CORS CORS(app, supports_credentials=True) app.run(host=host, port=port, debug=debug, workers=workers)
def run(): ''' Runs the app in debug mode for local development. ''' if not os.environ.get('APP_CONFIG', None): os.environ.update({'APP_CONFIG': os.path.join(CURR_FILE_DIR, 'config.py')}) from server import app app.run('0.0.0.0', 8000, debug=True)
def runserver(): if len(sys.argv) > 1: portNum = sys.argv[1] else: portNum = '8000' port = int(os.environ.get('PORT', portNum)) app.debug = True app.run(host='0.0.0.0', port=port)
def run_debug_server(): """ Test """ config = ConfigParser() config['DATABASE'].get('server') app.run('0.0.0.0', debug=True) return None
def server(config): set_config(config) from server import app port = int(os.environ.get("RECAST_FRONTEND_PORT", 5000)) ssl_kwargs = dict( ssl_context = (os.environ['RECAST_SSL_CERT'],os.environ['RECAST_SSL_KEY']) ) if os.environ.get('RECAST_SSL_ENABLE',True) else {} app.run(host='0.0.0.0', port=port, threaded = True, **ssl_kwargs)
def main(): app.config["state"] = State() # TODO Open the DB here and host = os.environ.get("FLASK_HOST", "0.0.0.0") try: port = os.environ.get("FLASK_PORT", "5000") port = int(port) except ValueError: port = 5000 debug = os.environ.get("FLASK_DEBUG", "True") debug = debug.lower().strip() in ["true", "yes", "1", "t"] app.run(debug=debug, host=host, port=port)
def run(): # Initialize Logger logger = logging.getLogger() formatter = logging.Formatter('[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s') handler = RotatingFileHandler('Animals.log', maxBytes=10000, backupCount=10) handler.setLevel(logging.DEBUG) handler.setFormatter(formatter) logger.addHandler(handler) std_handler = logging.StreamHandler(sys.stdout) std_handler.setLevel(logging.DEBUG) std_handler.setFormatter(formatter) logger.addHandler(std_handler) server_port = int(os.getenv('SERVER_PORT', '9000')) app.run(host='0.0.0.0', port=server_port, debug=True)
def create_wifi(): ap_ssid = "Light Trainer" ap_password = "******" ap_authmode = 3 # 0 Open / 3 WPA2-PSK wlan_ap = network.WLAN(network.AP_IF) wlan_ap.active(True) wlan_ap.config(essid=ap_ssid, password=ap_password, authmode=ap_authmode) wlan_ap.ifconfig(('1.1.1.1', '255.255.255.0', '1.1.1.4', '8.8.8.8')) print(wlan_ap.ifconfig()) print('Create WiFi ssid ' + ap_ssid + ', default password: ' + ap_password) print("start server") app.run(host="0.0.0.0", port=80, debug=True)
def main(): try: if settings.DEV_ENV: app.run(host=settings.API_HOST, port=settings.DEV_PORT, debug=settings.DEBUG) else: #in case when using sockets #try: #addr = '/tmp/{}_api_sock'.format(settings.FOLDER) #unlink(addr) #except OSError: #if exists(addr): #raise #sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) #sock.bind(addr) #app.run(host=None, port=None, sock=sock, debug=settings.DEBUG, workers=settings.API_WORKERS, log_config=None) #ssl = {'cert': "/etc/letsencrypt/live/{}/fullchain.pem".format(settings.API_HOST), #'key': "/etc/letsencrypt/live/{}/privkey.pem".format(settings.API_HOST)} app.run(host=settings.API_HOST, port=settings.PORT, sock=None, debug=settings.DEBUG, workers=settings.API_WORKERS, log_config=None) except KeyboardInterrupt: pass
#!flask/bin/python from server import app app.run(debug=True, port=8080)
from boxscore import * from databasemanager import DatabaseManager from webscraper import WebScraperManager import statistics from config import * from server import app if __name__ == '__main__': #database_manager = DatabaseManager() #web_scraper = WebScraperManager() app.run(debug=True)
from server import config from server import app if __name__ == '__main__': app.run(debug=config.debug, host=config.host, port=config.port)
#!/usr/bin/python from server import app, manager if __name__ == '__main__': app.run(debug = True, host="0.0.0.0", threaded=True)
from server import app as wsgi if __name__ == "__main__": wsgi.run()
############################ #Very basic python app to start the server. #Can be used locally for testing. #To compile the app, use 'export FLASK_APP=instant_server.py' #The app can then be run using python 'python instant_server.py' #It requires to have all the python requirements installed ('pip install requirements.txt') ############################## import os from server import app, db if __name__ == '__main__': port = int(os.environ.get('PORT', 5000)) debug = (port == 5000 or port == 8000) if debug: #A local database is used for testing #app.config['MONGODB_SETTINGS'] = {'db': 'local_db', 'host':'mongodb://localhost/test'} app.config['MONGODB_DB'] = 'local_db' app.config['MONGODB_HOST'] = 'mongodb://localhost/test' print('Debug mode is enabled. local_db used') app.run(host='0.0.0.0', port=port, debug=debug) #run() should not be used for production. Instead, gunicorn should be used in the procfile
import argparse import logging from logging.handlers import RotatingFileHandler from server import app parser = argparse.ArgumentParser( description='Now they always say congratulations.') parser.add_argument('--port', type=int, default=2015) parser.add_argument('--logging', type=bool, default=False) if __name__ == '__main__': args = parser.parse_args() if args.logging: # Set up logging handler = RotatingFileHandler('logs/postmalone.log', maxBytes=10000, backupCount=1) logging.getLogger('werkzeug').addHandler(handler) app.logger.addHandler(handler) app.run(threaded=True, port=args.port)
from server import app app.run(host='0.0.0.0', debug = True)
from server import app as application if __name__ == '__main__': application.run(host='0', port=4444, debug=True)
def server(config): set_config(config) from server import app port = int(os.environ.get("RECAST_PORT", 5000)) app.run(host='0.0.0.0', port=port, ssl_context = (os.environ['RECAST_SSL_CERT'],os.environ['RECAST_SSL_KEY']) )
# -*- coding:utf-8 -*- import socket # fetch local ip address localhost = socket.gethostbyname(socket.gethostname()) print localhost from server import app as application if __name__ == "__main__": application.run(host=localhost, debug=True)
from server import app as application from config import HOST, \ PORT, \ DEBUG if __name__ == '__main__': application.run(host=HOST, port=PORT, debug=DEBUG)
#!/usr/bin/env python # -*- coding: utf-8 -*- # author: le4f.net from server import app #如应用于生产环境 app.run(host='0.0.0.0', port=80) 并注意可能存在的安全隐患. if __name__ == '__main__': app.run(host='localhost', port=8080, debug=True)
from server import app if __name__ == "__main__": app.run(host="192.168.0.15", port=5000)
def runserver(): port = int(os.environ.get('PORT', 5000)) app.run(host='0.0.0.0', port=port)
#!/usr/bin/python3 from server import app if __name__ == "__main__": app.jinja_env.auto_reload = True app.config['TEMPLATES_AUTO_RELOAD'] = True app.run('0.0.0.0', 5000, ssl_context=('/etc/ssl/certs/server_cert.crt', '/etc/ssl/private/server_key.key'))
import sys from server import app, cfg app.run(host=cfg.get('web', 'host'), port=cfg.getint('web', 'port'), debug=True)
# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # #!/usr/bin/env python from server import app, db if __name__ == "__main__": # print app # print app.config['SQLALCHEMY_DATABASE_URI'] app.debug = True db.create_all(app=app) app.run(host='0.0.0.0',port=5002, debug=True) # if __name__ == "__main__": # from cherrypy import wsgiserver # # db.create_all(app=app) # # app.run(host='0.0.0.0',port=5000, debug=True) # d = wsgiserver.WSGIPathInfoDispatcher({'/': app}) # server = wsgiserver.CherryPyWSGIServer(('0.0.0.0', 5001), d) # try: # server.start() # except KeyboardInterrupt: # server.stop()
def server(): """ Run the demo server. """ app.run(host='0.0.0.0', debug=True, port=5001)
result = json.load(data_file) return jsonify(result) def check_date(date): all_dates = DBYouTube.get_dates()['dates'] if date == 'latest': return all_dates[0] else: for item in all_dates: if date == item: return date return None def get_error_message(status_code): with open('config/error_messages.json') as data_file: errors_json = json.load(data_file) error_message = [ error['message'] for error in errors_json['errors'] if error['status_code'] == status_code ] return error_message[0] if __name__ == '__main__': port = int(os.environ.get('PORT', 5000)) app.run(host='0.0.0.0', port=port, debug=True)
# For elastic beanstalk from server import app as application if __name__ == '__main__': application.run(host='0.0.0.0')
from server import app if __name__ == '__main__': app.run(port=5000, debug=True)
"""Interface for gunicorn. Run a server locally with: > gunicorn wsgi:app.server """ from server import app if __name__ == "__main__": app.run()
# use minecart to extract images from the pdf images = _find_images(infile) # for each image, use a goldfish extractor to get a watermark images = _find_watermarks(images) # check each watermark against the db _check_watermarks(images) # return successful results watermarked = [] for i in range(len(images)): image_info = images[i] if image_info['valid']: # convert to base64 output = StringIO() image_info['image_data'].save(output, format='PNG') im_data = output.getvalue().encode('base64') header = 'data:image/png;base64,' image_info['image_data'] = header + im_data sys.stdout.flush() watermarked.append(image_info) return watermarked else: return [] if __name__ == '__main__': app.run(debug=True, host='0.0.0.0')
# The entry point for the server from server import app import json settings = json.load(open('config.json')) app.run(debug=settings.get('debug', False), host=settings.get('host', '0.0.0.0'))
from server import app if (__name__ == '__main__'): app.run(host='localhost', port='8080', debug=True)
from server import app if __name__ == "__main__": app.run(host='0.0.0.0', port=8081)
from server import app app.run(port=5000, debug=True)
#! /usr/bin/env python #-*- coding: utf-8 -*- from server import app if __name__ == '__main__': app.run('0.0.0.0', 23300, debug=True)
import os from server import app if __name__ == '__main__': port = int(os.environ.get('PORT', 5000)) app.run(host='0.0.0.0', port=port, debug=True)
from server import app app.run(debug=True, host='0.0.0.0', port=80)
# este archivo solo sirvio en el desarrollo de la api from server import app if __name__ == "__main__": app.run(debug=True, host='0.0.0.0', port=9090)
def main(): try: app.run(host=CONFIG['host'], debug=CONFIG['debug'], port=CONFIG['port']) except KeyboardInterrupt: sys.exit(0)
from server import app from server.routes import http_routes ''' @TODO: Improvements: - Include hltv python lib to remove depenency with match dataset (hltv crawler) - Implement Model Selection ''' if __name__ == '__main__': app.run(host="0.0.0.0", port=8080, debug=True)
import os from server import app app.run( host='0.0.0.0', port=int(os.environ.get('PORT', 80)), debug=None )
def server(config): if config: os.environ['RECASTCONTROLCENTER_CONFIG'] = config from server import app port = int(os.environ.get("PORT", 5000)) app.run(host='0.0.0.0', port=port)
from server import app from settings import debug app.debug = debug app.run(host='0.0.0.0')
from flask import request from config import config from server import app import json @app.route('/', methods=['POST', 'GET']) def hello(): return json.dumps({"message": "hello"}) @app.route('/get-book-review', methods=['POST']) def get_book_review(): return json.dumps({"message": "hello"}) if __name__ == '__main__': app.run(host=config.get_config("flask", "host"), port=config.get_config("flask", "port"), debug=False, use_reloader=False)
from server import app import os if __name__ == '__main__': port = os.getenv('NEWSPAPER_PORT', '38765') app.run(port=int(port), host='0.0.0.0')
from server import app if __name__ == '__main__': # SIGINT to stop (Ctrl + C) app.run(debug=True) # Saves the data
#!/usr/bin/env python # -*- coding: utf-8 -*- # author: le4f.net from server import app #如应用于生产环境 app.run(host='0.0.0.0', port=80) 并注意可能存在的安全隐患. #有些情况下 localhost 会出问题,本地需要添加一个 hosts 。 if __name__ == '__main__': app.run(host='127.0.0.1', port=8080, debug=True)
# -*- coding: utf-8 -*- from server import db, app from models import User def init_db(): db.create_all() u1 = User(name='mao') u2 = User(name=u'毛哥') db.session.add_all([u1, u2]) db.session.commit() if __name__ == '__main__': init_db() app.run()
from server import app if __name__=="__main__": app.run('0.0.0.0', debug=True)
from server import app, soc from server.config import get_config app_config = get_config.get_config() if __name__ == '__main__': app.run(host=app_config["HOST"], port=app_config["PORT"], debug=app_config["DEBUG_STATUS"])
def run_server(): """ Run the demo server. """ app.run(debug=True, port=5001)