from myapplication import app app.run(host='0.0.0.0', debug=True)
from myapplication import app if __name__ == "__main__": app.run()
#!/usr/bin/python # -*- coding: utf-8 -*- ''' This script is used to launch myapplication. Application initialization should go here. ''' from flask import Flask from myapplication import app # the app is created here from myapplication.config import AppConfig from myapplication.controllers import * # register the controllers with Flask from myapplication.model import * # register any model (e.g. database) classes config = AppConfig() # get access to configuration information # register Flask modules (if any) here #app.register_module(xxx) app.run(debug=config.debugMode)
def scrape(): # Run the scrape function news = scrape_news.scrape() # Update the Mongo database using update and upsert=True (maybe lock to something other than button) mongo.db.collection.update({}, news, upsert=True) # Redirect back to home page return redirect("/") @app.route("/miseryindex") def misery(): return render_template("misery.html") @app.route("/stockindex") def stocks(): return render_template("stockSearch.html") @app.route("/home") def mainpage(): return redirect("/") if __name__ == "__main__": app.run(debug=True)
from os import environ from myapplication import app if __name__ == '__main__': HOST = environ.get('SERVER_HOST', 'localhost') try: PORT = int(environ.get('SERVER_PORT', '5555')) except ValueError: PORT = 5555 app.run(HOST, PORT)