예제 #1
0
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)
예제 #2
0
from backend import app

if __name__ == '__main__':
    app.run(threaded=True)
예제 #3
0
# 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)
예제 #4
0
from backend import app

if __name__ == '__main__':
    app.run(host='0.0.0.0')
예제 #5
0
#!/usr/bin/env python
"""
Run DSI app
"""
from backend import app

__author__ = "Shalyn Guthery"

if __name__ == '__main__':
    app.run(port=3000)
예제 #6
0
    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")
예제 #7
0
from backend import app

app.run('0.0.0.0', 8765, debug=True)
예제 #8
0
from backend import app
#app.run(debug=True, host="0.0.0.0")
app.run(debug=True,port=5000,host='0.0.0.0')
예제 #9
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)
예제 #10
0
#/usr/bin/python3
import os
from backend import app, db

db.create_all()
app.run(port=int(os.environ.get("PORT",3000)), debug=True)
예제 #11
0
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')
예제 #12
0
파일: server.py 프로젝트: steve2/COMP4350
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)
	
예제 #13
0
파일: mock.py 프로젝트: mjec/rc-niceties
from backend import app

app.run(debug=True, port=8000)
예제 #14
0
from backend import app

if __name__ == '__main__':
    app.run(host='127.0.0.1', port=8989)
예제 #15
0
import os
from backend import app

os.environ["FLASK_ENV"] = "development"


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8080)
예제 #16
0
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)
예제 #17
0
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)
예제 #18
0
# runbackend.py
from backend import app
 
if __name__ == '__main__':
    app.run(host='0.0.0.0',port=8080,debug=True)
예제 #19
0
파일: server.py 프로젝트: Risocos/regalos
        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')
예제 #20
0
#!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)
예제 #21
0
파일: run.py 프로젝트: AnteProlic/Scouts
from backend import app

if __name__ == '__main__':
    app.run(host='0.0.0.0', debug=True)
예제 #22
0
#!/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'],
    )
예제 #23
0
"""
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)
예제 #24
0
파일: main.py 프로젝트: bentd/case-api
#! env/bin/python

from backend import app

if __name__ == "__main__":

    app.run(host="0.0.0.0", port=5000)
예제 #25
0
from backend import app
#app.run(debug=True, host="0.0.0.0")
app.run(debug=True, port=5000, host='0.0.0.0')
예제 #26
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)
예제 #27
0
파일: run.py 프로젝트: memicq/FeedAutomator
from backend import app

if __name__ == '__main__':
    app.run()
예제 #28
0
from backend import app

if __name__ == '__main__': 
    app.run(debug=False)
예제 #29
0
@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')
예제 #30
0
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)
예제 #31
0
from backend import app
app.run(host="0.0.0.0", debug=True, threaded=True)

예제 #32
0
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)
예제 #33
0
from backend import app

if __name__ == "__main__":

    # run Flask dev-server
    app.config['SERVER_NAME'] = 'medicines.localhost:5001'
    app.run(port=5001)
예제 #34
0
    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')
예제 #35
0
from backend import app

if __name__ == '__main__':
    app.run('0.0.0.0', port=8080, threaded=True, debug=True)
예제 #36
0
파일: run.py 프로젝트: Autumn/cammap
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()
예제 #37
0
파일: run.py 프로젝트: Cyua/vue_flask_demo
# -*- 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)
예제 #38
0
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 )
예제 #40
0
"""Flask run settings."""

from backend import app

if __name__ == '__main__':
    app.run(host='127.0.0.1', port=5000, debug=True)
예제 #41
0
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)
예제 #42
0
파일: manage.py 프로젝트: KaKazuki/Leaves
from backend import app

if __name__ == '__main__':
    app.run(port=4000)
예제 #43
0
from backend import app as application

if __name__ == '__main__':
    application.run()
예제 #44
0
파일: run.py 프로젝트: ataki/sfpermit
def server():
    # engine.init()
    port = int(os.environ.get('PORT', 5000))
    app.run(host='127.0.0.1', port=port, debug=app.config['DEBUG'])