def runsockets(addr='0.0.0.0:17328'): # vacuum() auto_vacuum() host, port = addr.split(':') port = int(port) or 17328 # webbrowser.open("http://localhost:{}/".format(port)) print(f"Starting app at {addr}") socketio.run(app, host=host, port=port)
def runserver(): install_secret_key() app.logger.info('Starting with socketio-gevent') from app.dashboard.views import start_routines start_routines() socketio.run(app) app.logger.info('Stopping socketio-gevent')
def go(): print("Starting background threads") hardware_arb = arbiter.HardwareArbiter() login_arb = arbiter.LoginArbiter() app.config['ARBITER'] = hardware_arb app.config['LOGIN_ARBITER'] = login_arb timert.start_timer_thread() try: socketio.run(app, port=8080, log_output=True, use_reloader=False) except KeyboardInterrupt: pass print("SocketIO.run returned.") timert.stop_timer_thread() hardware_arb.close() print("Thread halted. App exiting.")
#!speedskate/bin/python from app import app, socketio socketio.run(app, '0.0.0.0', 5000, debug=True, use_reloader=False)
from app import socketio, app socketio.run(app, host="0.0.0.0")
from app import socketio, app if __name__ == "__main__": socketio.run(app, host="0.0.0.0", port=8000)
from app import app, socketio from tools.core import Scheduler if __name__ == '__main__': # run daemon in background daemon = Scheduler() daemon.start() # run web app socketio.run(app, host='0.0.0.0', port=5000)
#!/usr/bin/env python from app import app, socketio socketio.run(app, host="0.0.0.0") #app.run(host="0.0.0.0", debug = True)
from app import app, socketio from errors import registerAPIErrors from flask import session, request from flask_socketio import send, emit registerAPIErrors(app) import routes if __name__ == "__main__": # repr(app.url_map) socketio.run(app, host='0.0.0.0', debug=False)
from app import flask_app, socketio from flask import Flask ''' host = '127.0.0.1' port = 5000 ''' DEBUG = 1 if __name__ == "__main__": #Flask.run(flask_app,host=host,port=port,debug = DEBUG) #socketio.run(app=flask_app,host='127.0.0.1',port=9999,debug=1) socketio.run(app=flask_app, debug=DEBUG)
from app import app, socketio socketio.run(app, debug=True)
import threading import configparser import pretty_errors from requests import get from app import app, bot, socketio from flask_cors import CORS from termcolor import colored CORS(app) app.jinja_env.auto_reload = True app.config['TEMPLATES_AUTO_RELOAD'] = True Config = configparser.ConfigParser() Config.read("config.ini") if __name__ == '__main__': print(colored('Инициализация продукта', 'yellow')) print(colored('Загрузка потока Telegram бот', 'yellow')) my_thread = threading.Thread(target=bot.polling) my_thread.start() print(colored('Загрузка потока HTTP сервера Flask', 'yellow')) socketio.run(app, host=Config.get("http-server", "host"), port=int(Config.get("http-server", "port")))
import os import sys sys.path.append(os.path.join('/'.join(__file__.split('/')[:-1]), '../')) from app import app, socketio PORT = 5001 URL = os.environ.get('URL', 'http://localhost:' + str(PORT)) SERVER = '//'.join(URL.split('//')[1:]) if ':' in SERVER: PORT = int(SERVER.split(':')[-1]) elif 'PORT' in os.environ: PORT = int(os.environ['PORT']) if __name__ == '__main__': socketio.run(app, host='0.0.0.0', port=PORT, use_reloader=app.config['TYPE'] == 'localhost')
from app import create_app, socketio from logging.handlers import RotatingFileHandler import os if __name__ == "__main__": app = create_app("config") socketio.run(app, debug=True, host='127.0.0.1', port=5002) #socketio.run(app, debug=True ,host='0.0.0.0',port=5001) #uncomment when pushing to docker hub #app.run(debug=True,host='0.0.0.0') #push to server ,host='192.168.88.37' #app.run(debug=True,host='0.0.0.0')
from app import app from app import db from app.models import Users, Problems, Examples, TestCases, Courses, Assignments, Task from app import socketio # create shell context that adds database instance and models to the shell @app.shell_context_processor def make_shell_context(): return {'db': db, 'Users': Users, 'Problems': Problems, 'Examples': Examples, 'Task': Task} if __name__ == '__main__': socketio.run(app, debug=True, ssl_context=('./ssl.crt', './ssl.key'), host='0.0.0.0')
from app import web_app, socketio if __name__ == '__main__': socketio.run(web_app, host='0.0.0.0')
#!flask/bin/python from app import socketio, app socketio.run(app, debug=True, port=8000)
import os from app import socketio if __name__ == '__main__': # Bind to PORT if defined, otherwise default to 5000. port = int(os.environ.get('PORT', 5000)) socketio.run(host='0.0.0.0', port=port)
from app import app, socketio PORT = 8080 if __name__ == "__main__": print "Server is listening to port {}".format(PORT) socketio.run(app, port=PORT)
import app.routes from app import app, socketio if __name__ == '__main__': print("start!") socketio.run(app, host="0.0.0.0", port=80, debug=True)
__author__ = 'Xiaoxue' from app import socketio, app if __name__ == '__main__': socketio.run(app, host='0.0.0.0', policy_server=False)
from app import create_app, db, socketio if __name__ == '__main__': flask_app = create_app('dev') with flask_app.app_context(): db.create_all() socketio.run(flask_app)
from flask import Flask from app import create_app, socketio from app.models import Room, Message from flask.ext.whooshalchemy import whoosh_index # create app instance with the selected configuration app = create_app('default') whoosh_index(app, Room) whoosh_index(app, Message) if __name__ == '__main__': socketio.run(app) #host='192.168.1.3'
from app import create_app, socketio app = create_app() if __name__ == "__main__": socketio.run(app, debug=True, host="0.0.0.0")
def runserver(debug=True): #needs to be changed to False in production or for updating the data app.debug = debug socketio.run(app, host='127.0.0.1', port=port)
from app import create_app, socketio app = create_app(debug=True) if __name__ == '__main__': socketio.run(app, port=5000, host="0.0.0.0")
import os from app import socketio, create_app app = create_app(os.getenv('FLASK_CONFIG') or 'default') if __name__ == '__main__': socketio.run()
from app import app, socketio from trie import * import textpreprocess import vector_space # try starting the server try: #type of data to load (s = stemmed, l = lemmetized, n = no_preprocessing) try: #handle input for different python versions token_type = raw_input('Enter token type(s/l/n): ') except: token_type = input('Enter token type(s/l/n): ') print('Loading Data...') filename = 'trie/trie_'+token_type+'.pkl' #load global module objects textpreprocessor, trie, doc2idx and vector score calculator app.config['processor'] = textpreprocess.Process(token_type) app.config['trie'] = read_trie(filename) app.config['doc2idx'] = read_trie('doc2idx/doc2idx.pkl') app.config['eval'] = vector_space.Evaluate(app.config['trie'], app.config['doc2idx']) print('Data Loaded. Server Starting...') #establish socket.io stream and run server socketio.run(app, debug=False,port=app.config['PORT'], host=app.config['ADDRESS']) print('Server running at' + str(app.config['PATH'])) except KeyboardInterrupt: print('Now exiting') sys.exit()
"""Start the application under the code profiler.""" from werkzeug.contrib.profiler import ProfilerMiddleware app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions=[length], profile_dir=profile_dir) app.run() @manager.command def deploy(): """Run deployment tasks.""" from flask.ext.migrate import upgrade from app.models import Role, User # migrate database to latest revision upgrade() # create user roles Role.insert_roles() # create self-follows for all users User.add_self_follows() if __name__ == '__main__': socketio.run(app) # if __name__ == '__main__': # manager.run() # return User.query.join(Follow, Follow.followed_id == User.id)\ # .filter(Follow.follower_id == self.id).filter(Follow.followed_id != self.id).all()
#!/usr/bin/env python3 from app import create_app, socketio from werkzeug import SharedDataMiddleware import os if __name__ == '__main__': # create app app = create_app('sqlite:///app.db', debug=True) # route static files, normally the web server takes care of this app.wsgi_app = SharedDataMiddleware(app.wsgi_app, { '/': os.path.join(os.path.dirname(__file__), 'app/static'), }) # run app socketio.run(app, host='127.0.0.1')
from app import app as application from app import socketio as socketio if __name__ == "__main__": application.jinja_env.cache = {} socketio.run(application)
#!/bin/env python from app import ( create_app, socketio, ) if __name__ == '__main__': app = create_app(debug=True) socketio.run(app, host='127.0.0.1', port=2002)
#!/usr/bin/python from app import app,socketio socketio.run(app, "0.0.0.0", port=8000,debug=True)
next_page = url_for('index') return redirect(next_page) return render_template('login.html', title = 'Login',form = form) @app.route('/logout') def logout(): logout_user() return redirect(url_for('index')) @app.route('/register',methods = ['GET','POST']) def register(): if current_user.is_authenticated: return redirect(url_for('index')) form = RegistrationForm() if form.validate_on_submit(): user = User(username = form.username.data) user.set_password(form.password.data) db.session.add(user) db.session.commit() flash('Congrats, you are now a register user!') return redirect(url_for('login')) return render_template('register.html',title = 'Register' , form = form) if __name__ == '__main__': # app.run(debug = True) # socketio.run(app, host = 'localhost', port = 5000) socketio.init_app(app) socketio.run(app,debug = True)
#!/usr/bin/env python from app import app, socketio socketio.run(app, debug=True, host='0.0.0.0', port=3000)
""" Python module for running the application in debug mode. """ from app import socketio, app from flask_socketio import SocketIO if __name__ == '__main__': socketio.run(app, host='0.0.0.0', port=5001, debug=True) # type: SocketIO
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2016-03-04 15:18:58 # @Author : 陈小雪 # @Email : [email protected] from app import create_app, socketio app = create_app(debug=True) if __name__ == '__main__': socketio.run(app, host="0.0.0.0", port = 8888)
return redirect(next_page) return render_template('login.html', title='Login', form=form) @app.route('/logout') def logout(): logout_user() return redirect(url_for('index')) @app.route('/register', methods=['GET', 'POST']) def register(): if current_user.is_authenticated: return redirect(url_for('index')) form = RegistrationForm() if form.validate_on_submit(): user = User(username=form.username.data) user.set_password(form.password.data) db.session.add(user) db.session.commit() flash('Congrats, you are now a register user!') return redirect(url_for('login')) return render_template('register.html', title='Register', form=form) if __name__ == '__main__': # app.run(debug = True) # socketio.run(app, host = 'localhost', port = 5000) socketio.init_app(app) socketio.run(app, host='localhost', port=5000, debug=True)
from app import app, socketio if __name__ == '__main__': socketio.run(app, host='0.0.0.0', port=8008, debug=False)
import os from app import create_app, db, socketio from server.chat import Chat from flask_script import Manager, Shell from flask_migrate import Migrate, MigrateCommand app = create_app('development') manager = Manager(app=app) socketio.on_namespace(Chat('/chat')) def make_shell_context(): return dict(app=app, db=db) manager.add_command("shell", Shell(make_context=make_shell_context)) manager.add_command( 'run', socketio.run(app=app, host='127.0.0.1', port=8000, debug=True)) if __name__ == '__main__': manager.run()
#!/bin/env python from app import create_app, socketio app = create_app(debug=True) host = app.config.get("HOST") port = app.config.get("PORT") if __name__ == '__main__': print "Server running at http://%s:%s" % (host, port) socketio.run(app, host, port=int(port))
def rs(): socketio.run(app, host="0.0.0.0", port=port, debug=True)
def run(self): socketio.run(app, host=args.host, port=args.port, debug=args.debug)
import threaded import service from app import app, bot, socketio from flask_cors import CORS CORS(app) app.jinja_env.auto_reload = True app.config['TEMPLATES_AUTO_RELOAD'] = True if __name__ == '__main__': @threaded.ThreadPooled def polling(): bot.polling() polling() # server = pywsgi.WSGIServer(('', 5000), app, handler_class=WebSocketHandler) # server.serve_forever() socketio.run(app, port=5003)
# -*- coding: utf-8 -*- from app import socketio, app if __name__ == "__main__": socketio.run(app, port=5500)
#!/usr/bin/env python # -*-coding:utf8-*- """ @author: zhou @time:2019/6/20 10:33 """ import os from app import create_app, socketio, sch app = create_app(os.getenv('FLASK_CONFIG') or 'default') if __name__ == '__main__': my = sch.start socketio.start_background_task(target=my) socketio.run( app, debug=True, host='0.0.0.0', port=8889, )
#! /usr/bin/env python # -*- coding: utf-8 -*- from app import app, socketio socketio.run(app, host='0.0.0.0', port=8888)
# encoding: utf-8 """ @author: liuyun @time: 2019/4/10/010 10:14 @desc: """ from app import create_app, socketio if __name__ == '__main__': app = create_app() socketio.run(app, '0.0.0.0', debug=True)
# -*- coding: utf-8 -*- from app import appFlask, socketio # appFlask.run(debug=True, host='0.0.0.0') # appFlask экземпляр класса Flask(__name__) socketio.run(appFlask, debug=True, host='0.0.0.0')
def get_logger(file): logger = logging.getLogger( os.path.splitext(os.path.split((os.path.abspath(file)))[1])[0]) logger.setLevel(logging.INFO) logFormatter = logging.Formatter( "%(asctime)s - %(levelname)s - %(message)s") fileHandler = handlers.RotatingFileHandler( "{}{}".format(os.path.splitext(os.path.abspath(file))[0], ".log"), maxBytes=1024 * 1024 * 1, # 1MB backupCount=10, ) fileHandler.setFormatter(logFormatter) consoleHandler = logging.StreamHandler(sys.stdout) consoleHandler.setFormatter(logFormatter) logger.addHandler(fileHandler) logger.addHandler(consoleHandler) return logger logger = get_logger(__file__) if __name__ == "__main__": app = create_app() logger.info("start a flask server") socketio.run(app, host="0.0.0.0", port=5001)
from app import socketio,app if __name__ == "__main__": socketio.run(app,host='127.0.0.1',port=5000)
from app import create_app, socketio app = create_app(debug=True) if __name__ == '__main__': socketio.run(app, host='0.0.0.0', port=8000, debug=True)
from app import create_app, socketio from gevent import monkey monkey.patch_all() if __name__ == '__main__': app = create_app() socketio.run(app, port=80)
from app import app, socketio from flask_script import Manager, Server manager = Manager(app) manager.add_command( "runserver", Server(use_debugger=True, use_reloader=True, host="0.0.0.0", port=9000)) manager.add_command("dev", socketio.run(app, debug=True, host="0.0.0.0", port=8080)) if __name__ == '__main__': manager.run()
#!/usr/bin/env python2 from app import app, socketio socketio.run(app, host='0.0.0.0')
import os from werkzeug.middleware.proxy_fix import ProxyFix from app import create_app, socketio def fix_werkzeug_logging(): from werkzeug.serving import WSGIRequestHandler def address_string(self): forwarded_for = self.headers.get( 'X-Forwarded-For', '').split(',') if forwarded_for and forwarded_for[0]: return forwarded_for[0] else: return self.client_address[0] WSGIRequestHandler.address_string = address_string config_name = os.getenv('FLASK_ENV') app = create_app(config_name) app.wsgi_app = ProxyFix(app.wsgi_app) if __name__ == '__main__': socketio.run(app)
#!/bin/env python from app import create_app, socketio from flask_debugtoolbar import DebugToolbarExtension app = create_app(debug=True) toolbar = DebugToolbarExtension(app) if __name__ == '__main__': socketio.run(app, host=app.config['WEB_IP']) # End File: chat.py
### config Socket IO #from flask import Flask # from flask_socketio import SocketIO # import eventlet # eventlet.monkey_patch() # # socketio = SocketIO(app) # port_ = 3000 # debug_ = True if __name__ == '__main__': # if debug_ : # # print # print "= " *70 # #print " - app.config : ", app.config # print ## $ python run_pesticides.py ### for development #socketio.run(app, debug=debug_, port=port_) ### for production socketio.run(app, host='0.0.0.0')
#!/bin/env python from gevent import monkey import os monkey.patch_all() from app import create_app, socketio app = create_app(True) if __name__ == '__main__': port = os.getenv('VCAP_APP_PORT', '5000') socketio.run(app,host='0.0.0.0', port=int(port))
import os from app import create_app, socketio app = create_app(os.environ.get('FLASK_CONFIG') or 'default') if __name__ == '__main__': socketio.run(app, host='0.0.0.0', debug=False)