# DB operations if options.init_db: print('creating/updating database') db.create_all() create_system_resources() elif options.create_admin: parts = options.create_admin.split(':') email_address = parts[0] password = parts[1] assert '.' in email_address and '@' in email_address user_id = create_user(email_address, '', password, 'System Admin', User.SYSTEM_ADMIN) org_user = OrganizationUser() # add to system organization org_user.organization_id = find_resource('/system').id org_user.user_id = user_id org_user.is_admin = True db.session.add(org_user) db.session.commit() print('created system admin: %s' % email_address) elif options.migrate_db: migrate_keys() # start the debug server else: if options.enable_web_sockets: print('running with websockets') run_with_web_sockets() else: app.run(debug=True)
from main.app import app, db from main.routes import * from main.bases import fill_tasks, fill_news, \ fill_test_questions, create_teacher if __name__ == '__main__': db.create_all() # Создаем все сущности в базе fill_news() # Заполнить базу fill_test_questions() fill_tasks() create_teacher() app.run(port=8000, host='127.0.0.1') # Запустить сервер
from main.app import app app.run('0.0.0.0', port=8005)
#!/usr/bin/env python import os from main.app import app import main.app import main.routes if __name__ == "__main__": app.run(host='0.0.0.0', port=os.environ.get("FLASK_SERVER_PORT", 9090), debug=True)
import os # from .app import create_app from main.app import app # app = create_app() # app.app_context().push() # app.secret_key = os.urandom(16) if __name__ == '__main__': app.run(debug=True, ssl_context=('./ssl.crt', './ssl.key')) # app.run(debug=True, ssl_context=('./ssl.crt', './ssl.key'), host='0.0.0.0') # app.run('localhost', 5000, debug=True)
from main.app import app, db from main.api.blueprint import api app.register_blueprint(api, url_prefix='/api') if __name__ == '__main__': app.run(host='0.0.0.0')
def runserver(self, address='127.0.0.1', port=5000): app.run(address, port)
# DB operations if options.init_db: print('creating/updating database') db.create_all() create_system_resources() elif options.create_admin: parts = options.create_admin.split(':') email_address = parts[0] password = parts[1] create_admin_user(email_address, password) print('created system admin: %s' % email_address) elif options.migrate_db: pass # start the debug server else: if options.balena: try: balena_setup(app.config) except Exception as ex: # pylint: disable=broad-except # Don't log the full stack trace because this is likely a database error, which means the # stack trace will be huge; the system will retry the app if it fails which would lead to # huge volumes of log spew. logging.error('Unable to complete Balena setup: %s', ex) sys.exit(1) if options.run_as_worker: worker(blocking=False) app.run(host=options.listen_address, port=options.port, debug=True)
from main.app import app import os if __name__ == "__main__": app.run(port=os.environ.get("PORT") or "5000")
from main.app import app import os if __name__ == '__main__': app.run(port=os.environ.get('PORT'))
@app.route('/wx/delete_wx_regis', methods=['POST']) def remove_wx_regis(): """ 注销入口 :return: """ user_id = request.form['user_id'] result = delete_wx_regis(user_id) return result @app.route('/restaurants/get_restaurants', methods=['POST']) def get_restaurants(): user_id = request.form['user_id'] result = get_user_restaurant(user_id) return result @app.route('/restaurants/next', methods=['POST']) def random_food(): user_id = request.form['user_id'] result = next_restaurant(user_id) return result if __name__ == '__main__': # 运行flask.app app.run(host='0.0.0.0', port=4399, ssl_context=(SSL_PEM_PATH, SSL_KEY_PATH))