from db import startup from router import app import logging.config #Start DB startup() #Start Logger logging.config.fileConfig('logging.conf') #Init flask app print("Starting flask") if __name__ == '__main__': app.run(host='0.0.0.0', port=5000)
def run_blockchain(): sync.sync_overall() if __name__ == '__main__': sync.sync_overall() from apscheduler.schedulers.background import BackgroundScheduler sched = BackgroundScheduler(standalone=True) mine.sched = sched sched.add_job(mine.mine_for_block, kwargs={ 'rounds': STANDARD_ROUNDS, 'start_nonce': 0 }, id='mining') # add the block again sched.add_listener(mine.mine_for_block_listener, apscheduler.events.EVENT_JOB_EXECUTED) # , args=sched) sched.start() parser = ArgumentParser() parser.add_argument('-p', '--port', default=5000, type=int, help='port to listen on') args = parser.parse_args() port = args.port app.run(host='127.0.0.1', port=port)
from router import app if __name__ == "__main__": app.run()
from router import app if __name__ == '__main__': app.run(debug=True, threaded=False)
from router import app if __name__ == '__main__': app.run(port=8080)
from router import app as application if __name__ == "__main__": application.run()
# -*- coding: utf-8 -*- from router import app if __name__ == "__main__": app.run()
from router import app app.run(port="5000")
from router import app if __name__ == "__main__": app.run(debug=True)
if __name__ == '__main__': from argparse import ArgumentParser from router import app parser = ArgumentParser() parser.add_argument('-p', '--port', default=5000, type=int, help='port to listen on') args = parser.parse_args() port = args.port app.run(host='127.0.0.1', port=port, debug=True)