Ejemplo n.º 1
0
def main():
    # Create the EventHandler and pass it your bot's token.
    updater = Updater(TOKEN)

    # Get the dispatcher to register handlers
    disp = updater.dispatcher

    # on different commands - answer in Telegram
    disp.add_handler(CommandHandler('start', user_panel))
    disp.add_handler(CommandHandler('help', user_panel))
    disp.add_handler(CommandHandler('ping', ping))
    disp.add_handler(
        MessageHandler(Filters.all, manage_all, pass_chat_data=True))

    # log all errors
    disp.add_error_handler(error)

    # Start the Bot
    # updater.start_polling(poll_interval=1)
    updater.start_webhook(listen='0.0.0.0',
                          port=PORT,
                          url_path=TOKEN,
                          key='private.key',
                          cert='cert.pem',
                          webhook_url='https://%s:%s/%s' % (IP, PORT, TOKEN))

    # Create Web server, receive data from sensor (blocking function)
    app.run(debug=False, host='0.0.0.0')
Ejemplo n.º 2
0
def run():
    Stepper.get_instance()
    DHTSensor.get_instance("indoor")
    DHTSensor.get_instance("outdoor")
    BH1750.get_instance("indoor")
    BH1750.get_instance("outdoor")
    Window.get_instance()

    app.run("0.0.0.0", port=8081, threaded=True)
Ejemplo n.º 3
0
def start():
    '''
    host = 127.0.0.1 only access by localhost
    host = 0.0.0.0 any can access
    '''
    debug = app.debug
    host = app.config['APP_HOST']
    port = int(app.config['APP_PORT'])
    use_reloader = app.config['APP_USE_RELOADER']
    logger.info('Start run flask web app port:[%d]' % port)
    app.run(host=host, debug=debug, port=port, use_reloader=use_reloader)
Ejemplo n.º 4
0
def main():
    """
    主函数
    """
    logging.basicConfig(level=logging.DEBUG)
    args = add_args()
    raw_options = args.__dict__
    options = {
        'toc': "toc.html",
        'share': "bin/data",
        'join': "pages",
        'page': "page-.html"
    }
    for key, value in raw_options.items():
        if isinstance(value, str):
            value = value.encode("utf-8", 'surrogateescape').decode('utf-8')
        options[key] = value
    file_name = options['file']
    options['css'] = 'style.css'
    options['compress'] = bool(options['compress'])
    if file_name is None:
        options['web'] = 1
    loop = asyncio.get_event_loop()
    if options['web'] == 1:
        from web_app import app
        app.run(host="0.0.0.0", workers=1, access_log=False, debug=False)
        # app.config.REQUEST_TIMEOUT = 500
        # app.config.RESPONSE_TIMEOUT = 500
        # app.config.KEEP_ALIVE = False
        # app.config.KEEP_ALIVE_TIMEOUT = 60
    else:
        from converts.utils import logger
        from converts.epub2json import Epub2Json
        from converts.pdf2json import Pdf2Json

        if not os.path.exists(options['dist']):
            os.makedirs(options['dist'])
        convert = None
        if file_name.endswith('.epub'):
            convert = Epub2Json
        elif file_name.endswith('.pdf'):
            convert = Pdf2Json
        if convert is None:
            logger.error('only support book on epub, pdf!')
        else:
            converts = convert(options, loop)
            loop.run_until_complete(converts.run())
            logger.debug("meta: %s", converts.meta_data)
Ejemplo n.º 5
0
from web_app import app as application

if __name__ == "__main__":
        application.run()

Ejemplo n.º 6
0
from web_app import app
app.run(debug=True)
Ejemplo n.º 7
0
from web_app import app
import os
app.config['FLASK_APP']='run.py'
app.config['FLASK_ENV']='development'
app.config['SECRET_KEY'] = os.environ.get('WEB_APP_SECRET_KEY')
if __name__ == '__main__':
    app.run(debug=True, threaded=True)
Ejemplo n.º 8
0
# -*- coding: utf-8 -*-
"""
    Website project for www.FoodChasing.com

    :copyright: (c) 2016 by Zach Qiu/ Keran Chen.
    :license: BSD, see LICENSE for more details.
"""

from web_app import app

# turn on dev mode for development
if __name__ == "__main__":
    app.run()
Ejemplo n.º 9
0
from web_app import app

#pip install Flask
#FLASK_APP=web_app.py flask run

if __name__ == '__main__':
    app.run()
Ejemplo n.º 10
0
#!/usr/bin/env python
# coding:utf-8

from web_app import app

if __name__ == '__main__':
    app.run(host='0.0.0.0',port=9999,debug=True)
from web_app import app

if __name__ == '__main__':

    app.debug = True
    app.run(host='0.0.0.0', port=5000)
Ejemplo n.º 12
0
from web_app import app

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0', port=8080)
Ejemplo n.º 13
0
# -*- coding: utf-8 -*-
"""Entry point."""

from yaml import safe_load
from web_app import app as web_app

if __name__ == '__main__':
    with open('config.yaml') as stream:
        config = safe_load(stream)
    web_app.run(host=config.get('server_host', '0.0.0.0'),
                port=int(config.get('server_port', 9009)),
                debug=True)
Ejemplo n.º 14
0
'''
References:
    https://stackoverflow.com/a/60441931/13239458
'''

from flask import Flask
from flask_login import LoginManager
import database as db
from web_app import app

# app.add_url_rule('/', view_func=rou.index)
# app.add_url_rule('/login', view_func=rou.login)
# app.add_url_rule('/register', view_func=rou.register)

if __name__ == "__main__":
    app.run(host='127.0.0.1', debug=True)
Ejemplo n.º 15
0
from web_app import app

if __name__ == "__main__":
    app.run(host='0.0.0.0', debug=True, port=80)
Ejemplo n.º 16
0
"""
This script runs the FlaskWebProject1 application using a development server.
"""

from os import environ
import sys

sys.path.append('./')

from web_app import app
from web_app import views
from web_app.api import to
# from flask_script import Manager

# manager=Manager(app)

if __name__ == '__main__':

    HOST = environ.get('SERVER_HOST', '192.168.110.227')
    try:
        PORT = int(environ.get('SERVER_PORT', '5555'))
    except ValueError:
        PORT = 5555
    app.run(HOST, PORT)
Ejemplo n.º 17
0
# -*- coding: utf-8 -*-
# ! /usr/local/bin/python3
__author__ = 'p.olifer'
'''

'''

from web_app import app
app.run(host='0.0.0.0', port=5000, debug=True, threaded=True)
Ejemplo n.º 18
0
# -*- coding: utf-8 -*-
"""Entry point."""

from yaml import safe_load
from web_app import PeerCertWSGIRequestHandler, ssl_context, app as web_app

if __name__ == '__main__':
    with open('config.yaml') as stream:
        config = safe_load(stream)
    web_app.run(host=config.get('server_host', '0.0.0.0'),
                port=int(config.get('server_port', 9009)),
                ssl_context=ssl_context,
                request_handler=PeerCertWSGIRequestHandler,
                debug=True)
Ejemplo n.º 19
0
__author__ = 'Deyang'
from web_app import app

if __name__ == '__main__':
    app.run(host='0.0.0.0', debug=True)
Ejemplo n.º 20
0
# Run a test server
from web_app import app
if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8080, debug=False)
    print("App running on port 8082")
Ejemplo n.º 21
0
# Run a test server
from web_app import app
if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8080, debug=True)
    print("App running on port 8082")
Ejemplo n.º 22
0
    '%(levelname) -10s %(asctime)s %(name)s %(funcName)s %(lineno)d: %(message)s'
)
logging.basicConfig(level=logging.INFO, format=LOG_FORMAT)

key = 'QUEUE'
queue = os.environ.get(key, None)
if not queue:
    raise Exception('Environment variable %s not defined', key)

key = 'DSN'
dsn = os.environ.get(key, None)
if not dsn:
    raise Exception('Environment variable %s not defined', key)

key = 'HOST'
host = os.environ.get(key, 'localhost')

db = Database(dsn)
service = Service(queue, db)
service.start()

web_app.init(db, service)
app.run(host=host, ssl_context=('cert.pem', 'key.pem'))

try:
    service.join()
except KeyboardInterrupt:
    LOGGER.error('Caught Keyboard Interrupt, exiting...')
    service.close()
    service.join()
Ejemplo n.º 23
0
from web_app import app

if __name__ == '__main__':
    app.run(debug=True)
    # breakpoint()
Ejemplo n.º 24
0
from web_app import app

app.run('localhost', port=8000)
Ejemplo n.º 25
0
from web_app import app
from web_app import db

if __name__ == '__main__':
    db.create_all()
    app.secret_key = '123456'
    app.run(debug=True, host='0.0.0.0', port=8083, threaded=True)
Ejemplo n.º 26
0
from web_app import app

app.run(host='0.0.0.0', port=3001, debug=True)
Ejemplo n.º 27
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb  5 14:46:29 2020

@author: mmoussavi
"""

from web_app import app
app.run(host='0.0.0.0')
Ejemplo n.º 28
0
from web_app import app

if __name__ == '__main__':
    app.run(debug=True, port=5000)