def auth(client_id, client_secret, port): # perform Strava OAuth authorization... # # note: passing the client_id and client_secret in the url # isn't recommended! url = client.authorization_url( client_id=client_id, # redirect_uri = 'http://localhost:{0}/auth?client_id={1}&client_secret={2}'.format(port,client_id,client_secret), # nasty hack, bad idea! redirect_uri='http://localhost:{0}/auth'.format(port), scope=['read_all', 'activity:write']) # open url in the default browser webbrowser.open_new_tab(url) # launch the flask backend to catch the OAuth redirect from strava.com app.run(port=port)
from backend import app if __name__ == '__main__': app.run(threaded=True)
# this is entry point for the application # import global object for this application from backend import app, db # import other parts of the application (other modules) import api.models.phonebook import api.views # create tables, if you have to def create_tables(): list_tables = [api.models.phonebook.PhoneBook] db.create_tables(list_tables, safe = True) # run the script if __name__ == '__main__': create_tables() app.run(debug = True)
from backend import app if __name__ == '__main__': app.run(host='0.0.0.0')
#!/usr/bin/env python """ Run DSI app """ from backend import app __author__ = "Shalyn Guthery" if __name__ == '__main__': app.run(port=3000)
try: content = Content.get_or_create(from_id) except: # we only catch 404 here as later Content calls only refer to existing instances abort(404) #params for get_adjacency_sample adj_limit = int(request.args["limit"]) if "limit" in request.args else BACKEND_ADJACENCY_QUERY_LIMIT adj_doctype = request.args["docType"] if "docType" in request.args else None adjacencies = content.get_adjacency_sample(limit=adj_limit, docType=adj_doctype) result = {'id': from_id, 'docType': content.docType, 'title': content.title} result['adjacent_nodes'] = [] for adjacency in adjacencies: if adjacency.from_node == from_id: new_node = Content.get_or_create(adjacency.to_node) else: new_node = Content.get_or_create(adjacency.from_node) result['adjacent_nodes'].append( {'id': new_node.id, 'docType': new_node.docType, 'title':new_node.title }) return jsonify(result) if __name__ == "__main__": app.run(host="127.0.0.1")
from backend import app app.run('0.0.0.0', 8765, debug=True)
from backend import app #app.run(debug=True, host="0.0.0.0") app.run(debug=True,port=5000,host='0.0.0.0')
import os from backend import app port = int(os.environ.get('PORT', 5000)) app.run(host='0.0.0.0', port=port, debug=True)
#/usr/bin/python3 import os from backend import app, db db.create_all() app.run(port=int(os.environ.get("PORT",3000)), debug=True)
from backend import app if __name__ == "__main__": #app.run(debug=True,host='127.0.0.1',port=5000) app.run(debug=True, host='127.0.0.1', port=5000, ssl_context='adhoc')
import sys from backend import app if __name__ == '__main__': app.secret_key = "extra secret key" app.debug = '-p' not in sys.argv app.run(host='0.0.0.0', port=80)
from backend import app app.run(debug=True, port=8000)
from backend import app if __name__ == '__main__': app.run(host='127.0.0.1', port=8989)
import os from backend import app os.environ["FLASK_ENV"] = "development" if __name__ == '__main__': app.run(host='0.0.0.0', port=8080)
from backend import app if __name__ == '__main__': try: app.run(debug=True, threaded=True, host="0.0.0.0", port=80) except: app.run(debug=True, threaded=True, host="0.0.0.0", port=8080)
from backend import app from backend import db from backend import api from backend.endpoints import add_api db.create_all() add_api(api) if __name__ == '__main__': app.run(host='0.0.0.0', port=5000, debug=True) #app.run(debug=True)
# runbackend.py from backend import app if __name__ == '__main__': app.run(host='0.0.0.0',port=8080,debug=True)
token = jwt.encode( # the payload which will be encoded { 'public_id': user.public_id, 'exp': datetime.datetime.utcnow() + datetime.timedelta(hours=7) }, # key to use for encoding, which is needed when decoding. This is application specific app.config['SECRET_KEY']) return jsonify({'token': token, 'user': user_schema.dump(user).data}) return jsonify(error_msg), 401, { 'WWW-Authenticate': 'Basic realm="Login required!"' } @app.route('/uploads/projects/<path:filename>') def serve_project_file(filename): return send_from_directory( os.path.join(app.config['UPLOAD_FOLDER'], 'projects'), filename) @app.route('/uploads/users/<path:filename>') def serve_user_file(filename): return send_from_directory( os.path.join(app.config['UPLOAD_FOLDER'], 'users'), filename) if __name__ == '__main__': app.run(debug=True, host='localhost')
#!venv/bin/python import os import sys sys.path.insert(1, os.path.abspath(os.curdir)) sys.path.insert(1, os.path.join(os.path.abspath(os.curdir), 'lib')) from backend import app if __name__ == '__main__': app.run(host='0.0.0.0', port=5000)
from backend import app if __name__ == '__main__': app.run(host='0.0.0.0', debug=True)
#!/usr/bin/env python from backend import app if __name__ == '__main__': app.run( debug=True, host='0.0.0.0', port=app.config['DEBUG_PORT'], )
""" When run, starts the backend Flask server at port 4999 """ from backend import app, server if __name__ == '__main__': app.run(debug=True, threaded=True, host='0.0.0.0', port=4999)
#! env/bin/python from backend import app if __name__ == "__main__": app.run(host="0.0.0.0", port=5000)
from backend import app #app.run(debug=True, host="0.0.0.0") app.run(debug=True, port=5000, host='0.0.0.0')
from backend import app if __name__ == '__main__': app.config['ENV'] = 'development' app.run(host='0.0.0.0', port=8080, debug=True, use_reloader=True)
from backend import app if __name__ == '__main__': app.run()
from backend import app if __name__ == '__main__': app.run(debug=False)
@app.route('/user/<userid>', methods=['GET']) def user(userid=None): user_movies = db.session.query(Movies).filter(Movies.id == userid).all() if (user_movies): saved_movies = [] for movies in user_movies: saved_movies.append(movies.movies_data) return jsonify(saved_movies) else: return jsonify({ 'status': 'error', 'message': 'Error getting user' }), 400 @app.route('/remove', methods=['POST']) def remove(): data = request.get_json() movie = db.session.query(Movies).filter( Movies.id == data.get('id'), Movies.movie_id == data.get('movie_id')).first() if (movie == None): return jsonify({'status': 'error', 'message': 'Movie not found'}), 400 else: db.session.commit() return jsonify('Movie removed'), 201 if __name__ == '__main__': app.run(debug='true')
def runapp(debug=True): if debug: host = '0.0.0.0' else: host = '127.0.0.1' return app.run(debug=debug,host=host,port=8080)
from backend import app app.run(host="0.0.0.0", debug=True, threaded=True)
import logging.config from backend import app from settings import FLASK_DEBUG logging.config.fileConfig('logging.conf') log = logging.getLogger(__name__) if __name__ == '__main__': log.info('>>>>> Starting server <<<<<') app.run(debug=FLASK_DEBUG)
from backend import app if __name__ == "__main__": # run Flask dev-server app.config['SERVER_NAME'] = 'medicines.localhost:5001' app.run(port=5001)
return Response(response.text, status=200, mimetype='application/json') @app.route('/species/', methods=['GET']) def species(): species = Species.query.all() return Response(json.dumps([s.serialize() for s in species]), status=200, mimetype='application/json') @app.route('/species/<species_id>/sightings/<sightings_count>', methods=['POST']) def update_sightings(species_id, sightings_count): species = Species.query.get(species_id) # species = db.session.query(Species).get(species_id) species.sightings = sightings_count db.session.add(species) db.session.commit() return Response(json.dumps(species.serialize()), status=200, mimetype='application/json') if __name__ == '__main__': app.run(debug=True, host='0.0.0.0')
from backend import app if __name__ == '__main__': app.run('0.0.0.0', port=8080, threaded=True, debug=True)
from werkzeug.serving import run_with_reloader from backend import app import backend.serv PORT = 5000 if __name__ == '__main__': app.debug = True app.run() run_server()
# -*- coding: utf-8 -*- from backend import app from backend import config if __name__ == "__main__": app.run(port=config.WEB_SERVER_PORT, host="0.0.0.0", debug=True, threaded=True)
from backend import app, api # Controllers Imports from backend.api.User.Controller.UserController import UserController from backend.api.Alerts.Controller.AlertsController import AlertsController from backend.api.Devices.Controller.DevicesController import DevicesController from backend.api.Monitor.Controller.MonitorController import MonitorController from backend.api.RecoverPassword.Controller.RecoverPasswordController import RecoverPasswordController from backend.api.ResultsMetrics.Controller.ResultsMetricsController import ResultsMetricsController from backend.api.Sensor.Controller.SensorController import SensorController from backend.api.UserSettings.Controller.UserSettingsController import UserSettingsController from backend.api.HealthCheck import HealthCheck # Locals Imports import backend.constants as const api.add_resource(AlertsController, '/api/alerts/') api.add_resource(DevicesController, '/api/devices/') api.add_resource(MonitorController, '/api/monitor/') api.add_resource(RecoverPasswordController, '/api/recoverpassword/') api.add_resource(ResultsMetricsController, '/api/resultsmetrics/') api.add_resource(SensorController, '/api/sensor/') api.add_resource(HealthCheck, '/api/') api.add_resource(UserController, '/api/user/', '/api/user/<int:id_cliente>') api.add_resource(UserSettingsController, '/api/usersettings/') if __name__ == '__main__': app.run(debug=False, host=const.HOST_DEFAULT, port=const.PORT_DEFAULT)
from backend import app if __name__ == '__main__': app.run(debug = True )
"""Flask run settings.""" from backend import app if __name__ == '__main__': app.run(host='127.0.0.1', port=5000, debug=True)
from backend import app import os app.debug = True port = int(os.environ.get('PORT', 5000)) app.run(host='0.0.0.0', port=port)
from backend import app if __name__ == '__main__': app.run(port=4000)
from backend import app as application if __name__ == '__main__': application.run()
def server(): # engine.init() port = int(os.environ.get('PORT', 5000)) app.run(host='127.0.0.1', port=port, debug=app.config['DEBUG'])