from flask_rest_service import app app.run(debug=True, host='0.0.0.0')
# Code to test it locally from flask_rest_service import app app.run(debug=True)
from flask_rest_service import app app.run(debug=True)
# t.start() logging.error("check the crawler " + str(timespan)) conn.send(timespan) time.sleep(15); from multiprocessing import Process, Pipe import multiprocessing def rss_spider(): parent_conn, child_conn = Pipe() p = Process(target=main, args=(child_conn,)) p.start() global lastLogTime while True: a = parent_conn.recv() if(0 == a): p.terminate() parent_conn.close() lastLogTime = time.time() parent_conn, child_conn = Pipe() p = Process(target=main, args=(child_conn,)) p.start() logging.error(str(a) + "process:" + str(multiprocessing.active_children())) time.sleep(1) spider = Process(target=rss_spider) spider.start() app.run(debug=True, host='0.0.0.0')
from flask_rest_service import app import os if __name__ == '__main__': port = int(os.environ.get('PORT', 5000)) app.run(host='0.0.0.0', port=port, debug=os.environ.get('DEBUG', True))
from flask_rest_service import app app.run(debug=False)
from flask_rest_service import app import os port = int(os.environ.get('PORT', 5000)) app.run(debug=True,host= '0.0.0.0',port=port)
if request.args.get('id'): username = session['user'] _id = "ObjectId('" + request.args.get('id') + "')" workout_id = request.args.get('id') userWorkoutsCount = mongo.db.workouts.count({'username': username}) userWorkouts = mongo.db.workouts.find({'username': username}) workout = mongo.db.workouts.find_one({'_id': _id}) i = mongo.db.workouts.find({"_id": ObjectId(request.args.get('id'))}) return render_template("workout.html", i=i, workout=workout, _id=_id, userWorkoutsCount=userWorkoutsCount, userWorkouts=userWorkouts, username=username) #have a page for all workouts to show @app.route("/workouts", methods=['GET']) def workouts(): return render_template("workouts.html", username=username, userWorkouts=userWorkouts) #allow only certain pages to be accessible when not logged in endpoints_without_login = ['login', 'signup','index', 'static', 'images', 'stylesheets'] @app.before_request def require_login(): if not ('user' in session or request.endpoint in endpoints_without_login): return redirect("/") #in production, provide a unique key for security app.secret_key = 'dksfmskfslvnmksmkslmgskldm' if __name__ == '__main__': port = int(os.environ.get('PORT', 5000)) app.debug = True app.run(host='0.0.0.0', port = port)