def main(): parser = OptionParser(usage='usage: %prog [options]') parser.add_option('-r', '--run', action='store_true', dest='run', default=False, help='Running Flask in subprocess') (options, args) = parser.parse_args() if options.run: return app.run(host='0.0.0.0', debug=True) with FlaskTestClient(): unittest.main()
if 'lid' in session: id = session['lid'] uid = session['uid'] con = sql.connect("site.db") con.row_factory = sql.Row curr = con.cursor() q = """ SELECT * FROM messages WHERE (msg_by=? AND msg_to=?) OR (msg_by=? AND msg_to=?) ORDER BY id ASC """ curr.execute(q, ( id, uid, uid, id, )) chats = curr.fetchall() # cur = mysql.connection.cursor() # cur.execute("SELECT * FROM messages WHERE (msg_by=%s AND msg_to=%s) OR (msg_by=%s AND msg_to=%s) " # "ORDER BY id ASC", (id, uid, uid, id)) # chats = cur.fetchall() # cur.close() return render_template( 'chats.html', chats=chats, ) return redirect(url_for('login')) if __name__ == '__main__': app.run(debug=True)
def rundebug(): app.run(debug=True)
import os from run import app as application if __name__ == '__main__': port = int(os.environ.get('PORT', 5000)) application.run(host='0.0.0.0', port=port)
import os from run import app if __name__ == "__main__": if 'OPENSHIFT_PYTHON_IP' in os.environ: host = os.environ['OPENSHIFT_PYTHON_IP'] port = int(os.environ['OPENSHIFT_PYTHON_PORT']) app.run(host=host, port=port) else: app.debug = True app.run()
from run import app from config.config import logger if __name__ == '__main__': logger.debug('run 0.0.0.0:8815') app.run(host='0.0.0.0', port=8815 ##threaded=True )
from run import app if __name__ == "__main__": app.run(host="0.0.0.0", port=5000, debug=True)
from run import app as application if __name__ == "__main__": application.run()
from run import app, init_debug import os if __name__ == "__main__": init_debug() app.run(host=os.getenv('IP', '0.0.0.0'), port=int(os.getenv('PORT', 8080)), debug=True, processes=3)
def run(): app.run(host='0.0.0.0')
from run import app import os if __name__ == '__main__': app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 5000)), debug=True)
import os from run import app if __name__ == "__main__": port = int(os.environ.get('PORT', 80)) app.run(host='0.0.0.0', port=port)
def run(): return app.run()
def main(self): app.run(host=custom_config.get('host', '0.0.0.0'), port=custom_config.get('port', 5001))
#!/usr/bin/env python # https://blog.openshift.com/how-to-install-and-configure-a-python-flask-dev-environment-deploy-to-openshift/ from run import app as application # # Below for testing only # if __name__ == "__main__": application.run(debug=True) # We will set debug false in production
from run import app if __name__ == "__main__": app.run(port=5000)
from run import app if __name__ == "__main__": app.run(debug=True)
from run import app if __name__ == "__main__": app.run(host='0.0.0.0')
from run import create_app, app app = create_app("config") if __name__ == "__main__": app.run(use_debugger=True)
from run import app from flask import jsonify,render_template @app.route('/') def home(): return render_template('index.html') app.run(port= 4848)
from run import db, app import config @app.route("/") def hello(): var = 12345 return render_template( "index.html", to_show=var, ) @app.route("/size/<size>") def api_search(size): print(size) return "succes" @app.route("/games/demineur") def demineur(): return render_template("demineur.html", ) # Chat if __name__ == "__main__": db.create_all() app.run(port=config.PORT, debug=True, threaded=True)
#!/usr/bin/env python # -*- coding: UTF-8 -*- #from project import app from run import app if __name__ == "__main__": app.run()
@app.route("/game/codenames/api/submit/<id>") def api_codenames_submit(id): game = CodenamesGame.query.first() game.submit(id) game.status return game.get_public_board() @app.route("/game/codenames/api/clue/<clue>") def api_codenames_give_clue(clue): return "OK" if __name__ == "__main__": db.create_all() if (len(User.query.all()) == 0): chat = Chat() db.session.add(chat) lyon = User("lyon") paris = User("paris") db.session.add(lyon) db.session.add(paris) db.session.commit() socket_t = Thread(target=socketio.run, group=None, args=[app]) app.run(host='0.0.0.0', port=config.PORT, debug=True, threaded=True)
#!/usr/bin/env python # -*- coding: utf-8 -*- # only needed if not using gunicorn gevent if __name__ == '__main__': import gevent.monkey gevent.monkey.patch_all() from run import app # noqa if __name__ == '__main__': app.run(host=app.config['HOST'], port=app.config['PORT'], debug=app.config['INFO'])
from run import app from api import setup_api from database.create_db import create_db_if_not_exists if __name__ == "__main__": create_db_if_not_exists() setup_api() app.run(debug=True, host="0.0.0.0", port=5000)
import os import sys from run import app as application INTERP = "/home/eproject/anaconda3/envs/algo101/bin/python" if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv) algo102_path = '/home/eproject/vee-h-phan.com/algo102' sys.path.extend([ f'{algo102_path}/helpers', f'{algo102_path}/lib', f'{algo102_path}/webapp/app', f'{algo102_path}/webapp', f'{algo102_path}', ]) if __name__ == "__main__": application.run(debug=True) # Set this application constants here # with application.app_context(): # pass
def runserver(): app.run()
from run import app if __name__ == "__main__": app.debug=True app.run(host="0.0.0.0", port=8080)
try: data = poem_schema.load(json_data, partial=True) except exceptions.ValidationError as err: return {'message': err}, 422 db.session.add(data) db.session.commit() res = jsonify(poem_schema.dump(data)) return res # Route api.add_resource(Hello, '/Hello') api.add_resource(RecordingResource, '/recordings') api.add_resource(GetRecordingResource, '/recordings/<recording_id>') api.add_resource(LangagesResource, '/langages') api.add_resource(GetLangResource, '/langages/<lang_id>') api.add_resource(PoemsResource, '/poems') api.add_resource(GetPoemResource, '/poems/<poem_id>') @app.route('/files/<path:filename>') def download_file(filename): print(filename) return send_from_directory(os.getcwd() + "/static/", filename, as_attachment=True) if __name__ == "__main__": app.run(host='0.0.0.0', port=3005, debug=True)
from run import app if __name__ == '__main__': app.run(host="0.0.0.0", port=8877, threaded=True) # app.run(host="0.0.0.0",port=8877,threaded=True, ssl_context='adhoc')
else: flash("I'm sorry, there was an error with your input") return redirect(url_for('index')) @app.route('/query', methods=['GET', 'POST']) def query(): query = queryForm(request.form) return redirect(url_for('index', rating=query.rating.data, company=query.company.data, job_type=query.job_type.data)) def get_markers(query): if not query: markers = Marker.query.filter(Marker.valid == 1).all() else: q = [] if query[0] != '': q.append(" AND company = '{}'".format(query[0])) if query[1] != 'None': q.append(" AND job_type = '{}'".format(query[1])) search = "SELECT * FROM marker WHERE rating >= {} AND valid = 1".format(query[2]) for item in q: search += item search += ';' print search markers = Marker.query.from_statement(search) return markers if __name__ == '__main__': app.run()
from run import app import logging import os logging.basicConfig(level=os.environ.get("LOGGING_LEVEL", "INFO")) if __name__ == "__main__": app.run("0.0.0.0", debug=False)
def create_app(self): createConfig() app.run()