from recommender import app if __name__ == "__main__": app.run(debug=True)
from recommender import app # 建資料庫可使用 # from recommender import db # db.create_all() if __name__ == "__main__": app.run()
APP_ROOT = os.path.dirname( os.path.abspath(__file__)) # refers to application_top @app.route('/') @app.route('/news/') def news(): return render_template('news.html') @app.route('/how/') def how(): return render_template('how.html') @app.route('/about/') def about(): return render_template('about.html') @app.route('/get_news/<user_name>', methods=["GET"]) def get_news(user_name=None): # rdef get_recommendations(name): data = get_recommendations(user_name) # return articles return json.dumps(data) if __name__ == "__main__": app.run(host='0.0.0.0', port=5000, debug=True)
#!/usr/bin/env python from recommender import app # Port has been changed from 5000 to 80 so the domain name (kivaloans4.me) doesn't need a :5000 on # the end. However, root is required to run any port below 1024 so I have to use the command: # >> sudo /home/ubuntu/anaconda3/bin/python run.py # Since sudo automatically wants to call its own version of python, so I have to be direct and # specify it. #app.run(debug=True, host='0.0.0.0', port=5000) app.run(debug=True, host='0.0.0.0', port=80) #app.run(debug=True)