def run_app(args): """Function to run flask app""" # Configure flask app from config.py app.config.from_object('app.app_config') app.run(debug=app.config["DEBUG"], port=app.config["PORT"], host=app.config["HOST"])
def main(argv): port = 8000 host = '0.0.0.0' try: opts, args = getopt(argv, 'hdp:', ['help', 'debug', 'port=']) except GetoptError: print_help(2) debug = False for opt, arg in opts: if opt in ('-h', '--help'): print_help(0) elif opt in ('-d', '--debug'): debug = True elif opt in ('-p', '--port'): try: port = int(arg) except ValueError: print(f'Error: "{arg}" is not a valid port number') sys.exit(2) # print(f'Serving on port {port}') if debug: app.run(host=host, port=port, debug=True) else: serve(app, host=host, port=port)
from app.app import app if __name__ == '__main__': app.run(debug=True) # this will be false on production
from app.app import app from app.config import ServerConfig if __name__ == "__main__": app.run(host=ServerConfig.host, port=ServerConfig.port, threaded=ServerConfig.threaded, debug=ServerConfig.debug)
def begin(server): app.run(server=server)
import os from app.app import app, load_config load_config(app) if __name__ == "__main__": port = os.getenv("5000") app.run(host="0.0.0.0", port=port)
#!flask/bin/python from app.app import app if __name__ == '__main__': app.run(host="0.0.0.0", port=3000, debug = True)
#!/usr/bin/env python # -*- coding: utf-8 -*- from app.app import app realapp = app if __name__ == '__main__': app.run('0.0.0.0')
from dotenv import load_dotenv, find_dotenv load_dotenv(find_dotenv()) from app.app import app if __name__ == "__main__": app.run(host="0.0.0.0", port=5000)
###### App Config ###### import sys, os # Switch to the virtualenv if we're not already there INTERP = os.path.expanduser("~/env/wsgi/bin/python") if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv) sys.path.append(os.getcwd()) sys.path.append('~/<DOMAIN PATH>/app') from app.app import app as application if __name__ == '__main__': application.run(debug=False)
def masterLog(group): # this view may be replaced with an nginx log proxy of some sort group = load_group(current_user, group) with open(os.path.join('/build', group.directory, 'twistd.log')) as f: payload = f.readlines()[-100:] return Response(payload, mimetype='text/plain') @app.route('/api/builders/<group>', methods=['GET'], defaults={'path': ''}) @app.route('/api/builders/<group>/<path:path>', methods=['GET']) @login_required def builders(group, path): group = load_group(current_user, group) port = sum([group.port_offset, 20000]) r = requests.get(urljoin('http://127.0.0.1:' + str(port) + '/json', path)) return(r) @app.route('/api/force/<builder>', methods=['GET']) @login_required def force(builder): port = sum([current_user.port_offset, 20000]) r = requests.get(urljoin('127.0.0.1', str(port), '/builders', builder, 'force')) return(r) @app.route('/logout', methods=['POST']) @login_required def logout(): logout_user() return redirect(url_for('login')) if __name__ == "__main__": app.run(host='0.0.0.0')
from app.app import app app.run(debug=True)
"""Loads and runs application in production. """ from app.app import app app.debug = False app.run(port=52496, host='0.0.0.0')
# This is only for development. # # In production, Flask is run by mod_wsgi, which imports the via wsgi.py. from app.app import app app.debug=True app.run(port=8080, host='0.0.0.0')
from app.app import app if __name__ == "__main__": app.run(host="0.0.0.0", port=8080, debug=True)
from app.app import app from app.controllers import * app.run();
#!/usr/bin/env python # -*- coding: utf-8 -*- """ raspberrypi-modio-web ~~~~~~~~~~~~~~~~~~~~~ A simple Python webapp to control something via Olimex's MOD-IO2 :copyright: (c) 2013 by Christian Jann. :license: AGPL, see LICENSE for more details. """ from app.settings import settings from app.app import app if __name__ == '__main__': # '0.0.0.0': listen on all public IPs app.run(host='0.0.0.0', port=8080, debug=settings['debug'])
# coding=utf-8 # From directory app and then from file app, import app variable from app.app import app if __name__ == "__main__": app.debug = True app.run()
from app.app import app from app.task import delta_rss app.apscheduler.add_job(func=delta_rss, trigger='interval', seconds=60, id='rss') if __name__ == "__main__": app.run(host='0.0.0.0')
from app.app import app as App App.run( host='0.0.0.0', port=8080, debug=True )
args = parser.parse_args() if not ("VCAP_APP_HOST" in os.environ): app.config['HOST'] = str(args.host) app.config['PORT'] = int(args.port) app.config['DEBUG'] = False if args.debug == 'False' else True app.config['THREADED'] = False if args.threaded == 'False' else True if str(app.config['PORT']) != '80': app.config['SERVER_NAME'] += ':' + str(app.config['PORT']) # def main(argv): # try: # opts, args = getopt.getopt(argv,"hd:p:H:",["debug=","port=","host="]) # except getopt.GetoptError: # pass # for opt, arg in opts: # if opt == '-h': # print 'run.py -d <debug> -p <port> -H <host>' # sys.exit() # elif opt in ("-i", "--ifile"): # inputfile = arg # elif opt in ("-o", "--ofile"): # outputfile = arg if __name__ == "__main__": app.run(debug=app.config["DEBUG"], host=app.config["HOST"], port=app.config["PORT"], threaded=app.config['THREADED'])
# -*- coding:utf-8 -*- from app.app import app if __name__ == '__main__': app.run(debug=True, host='0.0.0.0')
from app.app import app import os port = int(os.environ.get("PORT", 5000)) #app related if __name__ == "__main__": app.run(port=port)
from app.app import app if __name__ == "__main__": app.run(port=8080)
from app.app import app if __name__ == "__main__": app.run(debug=False)
import sys from app.app import app if len(sys.argv) == 1: print("Requires an argument: http or https") else: if sys.argv[1] == 'http': app.run(host='127.0.0.1', port=8080) elif sys.argv[1] == 'https': context = ('domain.crt', 'domain.key') app.run(host='0.0.0.0', debug=True, port=8080, ssl_context=context)
from app.app import app if __name__ == "__main__": app.run(debug=True, host='0.0.0.0')#, https=True)
def runserver(host='0.0.0.0', port=None, **kwargs): """[-host HOST] [-port PORT] Runs the application on the local development server. """ app.run(host, port, **kwargs)
try: cursor.execute("SELECT 1") except: raise exc.DisconnectionError() cursor.close() import os @app.route('/favicon.ico') def favicon(): return flask.send_from_directory(os.path.join(app.root_path, 'static/images'), 'favicon.ico', mimetype='image/vnd.microsoft.icon') @app.before_request def before_request(): # リクエストのたびにセッションの寿命を更新する session.permanent = True app.permanent_session_lifetime = datetime.timedelta(minutes=30) session.modified = True if __name__ == '__main__': pgtids = {} redirect_pages = {} app.run(debug=True, host='0.0.0.0', port=5000)
from app.app import app import os if __name__ == "__main__": port = int(os.environ.get('PORT', 5000)) app.run(host='0.0.0.0', port=port)
import os import json from app.app import app DEBUG_PORT = json.loads(os.environ.get('DEBUG_PORT', 'null')) DEBUG = json.loads(os.environ.get('DEBUG', 'true')) # HOST = os.environ.get('HOST', '0.0.0.0') PORT = json.loads(os.environ.get('PORT', '8080')) if DEBUG_PORT is not None: import logging logging.warn( 'DEBUG_PORT is deprecated, please use DEBUG (true/false), and PORT') if os.environ.get('DEBUG') is None: DEBUG = True if os.environ.get('PORT') is None: PORT = DEBUG_PORT # TODO: Add `HOST` when DB `HOST` is fully removed app.run(host='0.0.0.0', port=PORT, debug=DEBUG)
from app.app import app from config.configDB import initialize_db from flask_restful import Api from api.routes import initialize_routes from flask_mongoengine import MongoEngine from flask_cors import CORS from middleware.security import initialize_Security from middleware.socketio import initialize_socketio cors = CORS(app) initialize_Security(app) initialize_db(app) api = Api(app) initialize_routes(api) initialize_socketio(app) if __name__ == '__main__': app.run(host="localhost", port=5000)
from app.app import app app.run(host="0.0.0.0")
python main.py cli Open command line interface python main.py app Open web interface Options: -h --help Show this screen -d --debug Start webapp in debug mode --version Show version """ parser = optparse.OptionParser(add_help_option=False) parser.add_option('-h', '--help', action="store_true") parser.add_option('--version', action="store_true") parser.add_option('-d', '--debug', action="store_true") options, args = parser.parse_args() try: if options.version: print "Python Linear Algebra Toolkit 1.0.0" elif sys.argv[1] == "cli": import cli elif sys.argv[1] == "app": from app.app import app app.run(debug=options.debug) elif options.help: print_helptext() else: print "Unknown command: " + " ".join(sys.argv[1:]) print_helptext() except: print_helptext()
from app.app import app if __name__ == "__main__": app.run(host="0.0.0.0", port=5000, debug=True)
import argparse from app.app import app if __name__ == "__main__": parser = argparse.ArgumentParser(description="Start the annotation server") parser.add_argument('--host', default="localhost") parser.add_argument('--port', default=5000) args = parser.parse_args() app.run(host=args.host, port=args.port, debug=False)
def run_app(args): app.run(debug=app.config["DEBUG"], port=app.config["PORT"], host=app.config["HOST"])
from app.app import app app.run(host='0.0.0.0', port=8001, debug=True)
# -*- coding: utf-8 -*- import os import sys sys.path.insert(0, os.path.dirname(__file__)) from app.app import app as application if __name__ == '__main__': application.run()
from app.app import app, init_db from app.constantes import DEBUG if __name__ == "__main__": #init_db() app.run(debug=DEBUG)
from app.app import app as application if __name__ == '__main__': application.run(host='0.0.0.0', port=8000, debug=True)
from app.app import app if __name__ == "__main__": app.run(host='0.0.0.0', port=8000)
from app.app import app,db if __name__ == '__main__': db.create_all() app.run(host='0.0.0.0',debug=True)
from app.app import app import os port = int(os.getenv("PORT")) app.run(host='0.0.0.0', port=port)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @Time: 2019/5/27 14:49 @Author: quanbin_zhu @Email: [email protected] """ import os from app.app import app from app.config.config import mockConfig from app.scheduler.tasks import scheduler from app.store.sqlitedb import db from app.controller.main_controller import recover_controller if __name__ == '__main__': db.create_all() scheduler.init_app(app) scheduler.start() host = mockConfig["mock-service"]["host"] port = os.environ["APP_PORT"] if "APP_PORT" in os.environ else mockConfig[ "mock-service"]["port"] app.register_blueprint(recover_controller) app.run(host=host if host else "127.0.0.1", port=port if port else 5000)
from flask import Flask from app.app import app from requests import get, post if __name__ == "__main__": app.run(host='0.0.0.0', port=5005)
from app.app import app if __name__ == '__main__': app.debug = True app.run()
__author__ = 'Dante <*****@*****.**>' from app.app import app app.run('0.0.0.0', 8765, debug=True)
from app.route.route import * from app.app import app from app.config import * if __name__ == '__main__': # 启动服务 # app.run() # 0.0.0.0 表示外网所有人都能访问 app.run(host=HOST, port=PORT, debug=DEBUG)
def runserver(host, port, debug): app.run(host=host, port=port, debug=True)
#!/usr/bin/python # -*- coding: UTF-8 -*- from app.app import app if __name__ == "__main__": app.run(debug=True)
from app.app import app if __name__ == '__main__': app.run(debug=True, host='0.0.0.0', port=8017)