def run(): """Runs the flask server """ # pre server start from webapp import admin from webapp import models admin.setup() models.setup() # start/run server server_type = core_settings.SERVER_TYPE if server_type == 'cherrypy': # near-production level server (small to medium traffic) import server_cherrypy server_cherrypy.run() elif server_type == 'tornado': import server_tornado server_tornado.run() elif server_type == 'gevent': import server_gevent server_gevent.run() else: # default server (flask/werkzeug) # dev or low traffic app.run( host=core_settings.SERVER_ADDRESS, port=core_settings.SERVER_PORT, debug=core_settings.DEBUG, # True if the web server process should handle each request in a separate thread. # You can only have one or the other; multi-threaded or multi-process. threaded=True, # The number of processes to spawn for the server. # You can only have one or the other; multi-threaded or multi-process. processes=1)
def launcher(): try: app.run() except errors.FloodWait as e: sleep(e.x) except errors.RPCError as e: exit(1)
def main(): arg_parser = ArgumentParser(description="") arg_parser.add_argument("-p", "--port", default=5000, type=int) arg_parser.add_argument("--host", default="127.0.0.1") arg_parser.add_argument("action", type=str, nargs='?', default='start', choices=('start', 'test', 'config')) args = arg_parser.parse_args() if args.action == "start": app.run( host=args.host, use_reloader=(app.config['USE_RELOADER'] == 'True'), debug=True, use_debugger=True, port=args.port, extra_files=handler_list) elif args.action == "config": for key, value in app.config.items(): print("%s: %s" % (key, value))
def run(): """Runs the flask server """ # pre server start from webapp import admin from webapp import models admin.setup() models.setup() # start/run server server_type = core_settings.SERVER_TYPE if server_type == "cherrypy": # near-production level server (small to medium traffic) import server_cherrypy server_cherrypy.run() elif server_type == "tornado": import server_tornado server_tornado.run() elif server_type == "gevent": import server_gevent server_gevent.run() else: # default server (flask/werkzeug) # dev or low traffic app.run( host=core_settings.SERVER_ADDRESS, port=core_settings.SERVER_PORT, debug=core_settings.DEBUG, # True if the web server process should handle each request in a separate thread. # You can only have one or the other; multi-threaded or multi-process. threaded=True, # The number of processes to spawn for the server. # You can only have one or the other; multi-threaded or multi-process. processes=1, )
def run(): """Runs the flask server """ # pre server start admin.setup() models.setup() # start/run server server_type = core_settings.SERVER_TYPE if server_type == 'cherrypy': # near-production level server (small to medium traffic) import server_cherrypy server_cherrypy.run() else: # default server (flask/werkzeug) if SERVER_PROCESSES > 1 and SERVER_IS_THREADED: raise Exception('Choose either multi-threaded or multi-process') # dev or low traffic app.run( host=core_settings.SERVER_ADDRESS, port=core_settings.SERVER_PORT, debug=core_settings.DEBUG, # support multi-thread requests outside of DEBUG mode threaded=SERVER_IS_THREADED, processes=SERVER_PROCESSES) pass
#!/usr/bin/env python3 from core import app if __name__ == '__main__': # Local app.run(host='127.0.0.1', port=5000, debug=True)
from core import app as application from flask_cors import CORS from router import router_blueprint, router import sys import logging import os router.init_app(application) application.register_blueprint(router_blueprint) application.config.from_pyfile(os.environ['setting']) try: logging.getLogger().debug(application.config.get('DEBUG_SERVER')) if application.config.get('DEBUG_SERVER'): CORS(app=application, supports_credentials=True, expose_headers='.*') if __name__ == '__main__': application.run(host="0.0.0.0", debug=True, port=2001, threaded=True) elif application.debug: if __name__ == '__main__': application.run(host="0.0.0.0", debug=True, port=2001, threaded=True) except: e = sys.exc_info()[0] logging.getLogger().error(e)
from core.models.cms.piece import Piece from core.models.cms.author import Author from core.models.cms.list import List from core.models.cms.list_post import ListPost from core.models.cms.comment import ListPostComment from core.models.cms.survey import Survey from core.models.cms.survey_answer import SurveyAnswer from core.models.cms.comment import SurveyComment Piece.define_routes() Author.define_routes() List.define_routes() ListPost.define_routes() ListPostComment.define_routes() Survey.define_routes() SurveyAnswer.define_routes() SurveyComment.define_routes() if __name__ == '__main__': if app.config['DEBUG']: app.run(threaded=True) else: http_server = HTTPServer(WSGIContainer(app)) http_server.listen(5000) IOLoop.instance().start()
import traceback import sys from core import app try: app.debug = True if ( app.debug ): from werkzeug.debug import DebuggedApplication app.wsgi_app = DebuggedApplication( app.wsgi_app, True ) app.run(host='127.0.0.1') except: with open("/home/yuzheng/git/tushishuo/log.txt","w") as file: file.write(traceback.format_exc())
import os from core import app from core import helpers # noqa: F401, F801 from core import views # noqa: F401, F801 from user import views # noqa: F401, F801 from auth import views # noqa: F401, F801 from blog import views # noqa: F401, F801 from trips import views # noqa: F401, F801 from around import views # noqa: F401, F801 from api import views # noqa: F401, F801 if app.config['DEBUG']: from core.debug import * # wsgi application = app if __name__ == '__main__': app.run(debug=app.config['DEBUG'], host=app.config.get('HOST'), port=app.config.get('PORT'))
# SurveyAnswer.define_routes() # SurveyComment.define_routes() from core.models.hotels.hotel import Hotel from core.models.hotels.room import Room Hotel.define_routes() Room.define_routes() # from core.models.tasks.scheduled import ScheduledTask # from core.models.tasks.triggered import TriggeredTask # ScheduledTask.define_routes() # TriggeredTask.define_routes() # @app.route('/clear', methods=['POST']) # def clear(): # for cache in app.caches: # app.caches[cache].clear() # return 'CLEARED' if __name__ == '__main__': if app.config['DEBUG']: app.run(threaded=True, port=8080) else: http_server = HTTPServer(WSGIContainer(app)) http_server.listen(5000) IOLoop.instance().start()
from ariadne import graphql_sync from ariadne.constants import PLAYGROUND_HTML from flask import request, jsonify from core import app from schema import schema @app.route("/", methods=["GET"]) def graphql_playground(): return PLAYGROUND_HTML, 200 @app.route("/", methods=["POST"]) def graphql_server(): data = request.get_json() success, result = graphql_sync(schema=schema, data=data, context_value=request, debug=app.debug) status_code = 200 if success else 400 return jsonify(result), status_code if __name__ == "__main__": app.run(debug=True)
__author__ = 'gnaughton' # Momentum leaderboards # Made with love in the Poconos # 2015 [email protected] from core import app if __name__ == "__main__": app.run( debug=True, threaded=True )
import sys import time import os if __name__ == "__main__": from core import app print('正在打开服务器...') app.run(host='0.0.0.0', port=80, debug=True) #app.run()
from core import app app.run(host="0.0.0.0", debug=True)
# -*- encoding: utf8 -*- import os import api.views from core import app import core.signals.listener if __name__ == '__main__': app.run(host="0.0.0.0", port=6001, debug=True)
"""Usage: run.py [--host=<host>] [--port=<port>] [--debug | --no-debug] --host=<host> set the host address or leave it to 0.0.0.0. --port=<port> set the port number or leave it to 5100. """ from docopt import docopt arguments = docopt(__doc__, version='0.1dev') host = arguments['--host'] port = arguments['--port'] debug = not arguments['--no-debug'] from core import app if not port: port = 5100 if not host: host = '0.0.0.0' app.run(debug=debug, host=host, port=int(port))
import core.app import sys if __name__ == "__main__": app = core.app.Application() sys.exit(app.run())
#!/usr/bin/env python3 from core import app if __name__ == '__main__': app.run(host='0.0.0.0')
# -*- encoding: utf-8 -*- from core import app if __name__ == '__main__': app.run('0.0.0.0', debug=False) # False
@app.route("/about") def about(): """Render the about template""" data = { 'about' : 'Api Socientize application', 'version' : API_VERSION, 'IP': request.remote_addr, 'IP2': request.headers['X-Forwarded-For'], 'browser': request.headers['User-Agent'], } return jsonify( data) app.register_blueprint( api_v1_0_bp, url_prefix='{prefix}/v{version}'.format( prefix='/api', version=API_VERSION_V1_0)) app.register_blueprint( api_v1_1_bp, url_prefix='{prefix}/v{version}'.format( prefix='/api', version=API_VERSION_V1_1)) if __name__ == "__main__": # pragma: no cover #logging.basicConfig(level=logging.NOTSET) app.run(host=app.config['HOST'], port=app.config['PORT'], debug=app.config.get('DEBUG', True)) app.logger.debug('Entro por main')
from core import app if __name__ == "__main__": app.run(host="0.0.0.0", debug=True)
#!/usr/bin/python3 from core.config import run from core import app app.run(debug=run["debug"], threaded=run["threaded"], host=run["host"], port=run["port"])
@app.route("/sub") def substitution(): return render_template('substitution.html') @app.route("/fmt") def formatter(): return render_template('formatter.html') @app.route("/templater") def templater(): return render_template('templater.html') @app.route("/builder") def builder(): return render_template('builder.html') @app.route('/favicon.ico') def favicon(): return send_file('static/favicon.ico') init_services() if __name__ == '__main__': app.run(host="0.0.0.0", port=5000, debug=True)
import core.app app = core.app.app db = core.app.init_db() cache = core.app.init_cache() login_manager = core.app.init_login_manager() sentry = core.app.init_sentry() core.app.init_statsd() import models from views import * warm_template_cache(app) if __name__ == '__main__': app.run( # pragma: no cover host='0.0.0.0', threaded=True, debug=True, extra_files=[ 'frontend/static/dist/bundle.js', 'frontend/static/dist/main.css', 'frontend/templates/index.html', ], )
import time from core import (bot, app, WEBHOOK_URL_BASE, WEBHOOK_URL_PATH) # Telegram Bot Code @bot.message_handler(commands=['start']) def start(message): bot.send_message(message.chat.id, "Hello, World :)") # Remove webhook bot.remove_webhook() time.sleep(0.1) # Set webhook bot.set_webhook(url=WEBHOOK_URL_BASE + WEBHOOK_URL_PATH) if __name__ == "__main__": app.run(host=WEBHOOK_URL_BASE)
from core import app app.run(debug=True, host='0.0.0.0', port=6500)
__author__ = 'gnaughton' # Momentum leaderboards # Made with love in the Poconos # 2015 [email protected] from core import app if __name__ == "__main__": app.run(debug=True, threaded=True)
# -*- encoding: utf8 -*- from core import app import testapp.views if __name__ == '__main__': app.run(host="0.0.0.0", port=8000, debug=app.debug)
from core import app if __name__ == "__main__": app.run()
from core import app, config if __name__ == '__main__': app.run(threaded=True, debug=True, host=config.get("Default", "CORE_TCP_IP"), use_reloader=False, port=int(config.get("Default", "CORE_TCP_PORT")))
from core import app if __name__ == '__main__': app.run(debug=False)
import os from core import app __author__ = 'mblaul, gocnak, janelyousif' if __name__ == "__main__": app.run(debug=True, host=os.getenv('IP', '0.0.0.0'), port=int(os.getenv('PORT', 8080)))
#!/usr/bin/env python3 # app.py """ Start: 07/25/2017 Written by: Precious Kindo -- KindoLabs """ import os from flask import Flask, abort from core import app app.debug = app.config['DEBUG'] app.threaded = True port = int(os.environ.get('PORT', 5000)) app.run(host='0.0.0.0', port=port)
from core import app from config import port, is_debug if __name__ == '__main__': print(app.url_map) app.run(port=port, debug=is_debug)
from core import app if __name__ == '__main__': app.run(port=5001)
#!/usr/bin/python from core import app app.run(host='0.0.0.0', port=80, threaded=True, debug=True)
#!/usr/bin/env python # -*- coding: utf-8 -*- from core import app if __name__ == "__main__": app.run(debug=True)
#!/usr/bin/env python #-*- coding: utf8 -*- from core import app app.run(host=app.config['APPLICATION_HOST'], port=app.config['APPLICATION_PORT'], debug=app.config['DEBUG'])
from flask import render_template, request, url_for from engine.api import blueprint as api from meb.collaborate import blueprint as collaborate from meb.util import crossdomain from administration.admin import blueprint as admin from meb_results.results import blueprint as results from core import app app.register_blueprint(collaborate, url_prefix='/collaborate') app.register_blueprint(api, url_prefix='/api') app.register_blueprint(admin, url_prefix='/admin') app.register_blueprint(results, url_prefix='/results') cors_headers = ['Content-Type', 'Authorization'] @app.route('/') @crossdomain(origin='*', headers=cors_headers) def home(): return render_template("/index.html") def url_for_other_page(page): args = request.view_args.copy() args['page'] = page return url_for(request.endpoint, **args) app.jinja_env.globals['url_for_other_page'] = url_for_other_page if(__name__ == "__main__"): app.run(debug=app.config['DEBUG'], host=app.config['HOST'], port=app.config['PORT'])
from tornado.wsgi import WSGIContainer from tornado.httpserver import HTTPServer from tornado.ioloop import IOLoop from core import app import webbrowser if __name__ == '__main__': if app.config['DEBUG']: app.run(port=8080, threaded=True) else: server = HTTPServer(WSGIContainer(app)) server.listen(5000) IOLoop.instance().start()
from core import app from OpenSSL import SSL context = SSL.Context(SSL.SSLv23_METHOD) context.use_privatekey_file('server.key') context.use_certificate_file('server.crt') app.run(host="0.0.0.0", debug=True, ssl_context=context)
from models import Students @app.route('/') def show_all(): return render_template('show_all.html', students=Students.query.all() ) # or Students.query.filter_by(city='').all() @app.route('/new', methods=['GET', 'POST']) def new(): if request.method == 'POST': if not request.form['name'] or not request.form[ 'city'] or not request.form['addr']: flash('Please enter all the fields', 'error') else: student = Students(request.form['name'], request.form['city'], request.form['addr'], request.form['pin']) db.session.add(student) db.session.commit() flash('Record was successfully added') return redirect(url_for('show_all')) return render_template('new.html') if __name__ == '__main__': db.create_all() app.run('localhost', 8000)
__authors__ = ['Khyber Sen', 'Bayan Berri', 'Naotaka Kinoshita', 'Brian Leung'] __date__ = '2017-10-30' from core import app if __name__ == '__main__': app.run()
#!/usr/bin/env python # coding: utf-8 from core.app import run if __name__ == '__main__': run()