コード例 #1
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--port',
                        dest='port',
                        default='5000',
                        help='Specify port -- usually for testing.')
    parser.add_argument('--host',
                        dest='host',
                        default='localhost',
                        help='Specify host -- usually for testing.')

    args = parser.parse_args()

    if args.init:
        sys.exit(0)
    else:
        app.run(host=args.host, port=args.port, debug=app_env.debug)
コード例 #2
0
from covid import app

if __name__ == '__main__':
    app.run(host='0.0.0.0')
コード例 #3
0
from covid import app

if __name__ == "__main__":
    app.run()
コード例 #4
0
ファイル: covid.py プロジェクト: Bashirkazimi/covid19-viz
from covid import app
app.run(host='0.0.0.0', port=3001, debug=True)
コード例 #5
0
from covid import app

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=80, debug=True)
コード例 #6
0
ファイル: main.py プロジェクト: Kh125/Covid-19
from covid import app
app.run(host='0.0.0.0', port=8080)
コード例 #7
0
from covid import app

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8080, ssl_context=('cert.pem', 'privkey.pem'))
コード例 #8
0
"""
This script runs the covid application using a development server.
"""

from os import environ
from covid import app

if __name__ == '__main__':
    HOST = environ.get('SERVER_HOST', '0.0.0.0')
    try:
        PORT = int(environ.get('SERVER_PORT', '55555'))
    except ValueError:
        PORT = 55555
        
    app.run(HOST, PORT)
コード例 #9
0
@app.route('/favorite/<country>', methods=['PUT'])
@login_required
def change_watchlevel(country):
	if not request.json or not 'WatchLevel' in request.json:
		return jsonify({'error':'new WatchLevel is needed'}), 400
	if request.json["WatchLevel"] not in ["high", "middle", "low"]:
		return jsonify({'error':'WatchList must be "high", "middle" or "low"'}), 400

	favorite_country = Favorite.query.filter_by(favorite_user=current_user).filter_by(slug=country).first()
	favorite_country.watchlevel = request.json["WatchLevel"]
	db.session.commit()
	return jsonify({'message': 'the WatchLevel of {} is updated to {}'.format(country, request.json["WatchLevel"])}), 200


@app.route('/favorite/<country>', methods=['DELETE'])
@login_required
def delete_favorite_country(country):
	if country not in [favorite.slug for favorite in Favorite.query.filter_by(favorite_user=current_user).all()]:
		return jsonify({'error':'no such country in your favorite countries'}), 400
	Favorite.query.filter_by(favorite_user=current_user).filter_by(slug=country).delete()
	db.session.commit()
	return jsonify({'success': True})


if __name__=="__main__":
    app.run(debug=True)