Example #1
0
def method_name():
    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)
        elif (course == '5'):
            return json.dumps(Calculus2Bll.generateExam(unit))
        elif (course == '6'):
            return json.dumps(LinearAlgebraBll.generateExam(unit))
        elif (course == '7'):
            return json.dumps(TrigonometryBll.generateExam(unit))
        elif (course == '8'):
            return json.dumps(ProbabilityBll.generateExam(unit))
        elif (course == '9'):
            return json.dumps(statisticsBll.generateExam(unit))
        elif (course == '10'):
            return json.dumps(StatisticalInferenceBll.generateExam(unit))
        elif (course == '11'):
            return json.dumps(discreteMathematicsBll.generateExam(unit))
        return 'course or unit invalid'

    @app.route(defaultRoute + '/getData', methods=['GET'])
    def getData():
        cursos = coursesBll.getData()
        return json.dumps(cursos)

    @app.route(defaultRoute + '/mixExam', methods=['POST'])
    def mixExam():
        json_data = request.json
        selected = coursesBll.getQuetions(json_data)
        return json.dumps(selected)


if __name__ == '__main__':
    app.run(debug=True)
Example #3
0
"""
This script runs the FlaskWebProject1 application using a development server.
"""

from os import environ
from FlaskWebProject1 import app

if __name__ == '__main__':
    HOST = environ.get('SERVER_HOST', 'localhost')
    try:
        PORT = int(environ.get('SERVER_PORT', '5555'))
    except ValueError:
        PORT = 5555
    app.debug = True
    app.run(HOST, PORT)
Example #4
0
"""
This script runs the FlaskWebProject1 application using a development server.
"""

from os import environ
from FlaskWebProject1 import app

if __name__ == '__main__':
    # Bind to PORT if defined, otherwise default to 5000.
    port = int(environ.get('PORT', 5000))
    app.run(host='0.0.0.0', port=port)
Example #5
0
"""
This script runs the FlaskWebProject1 application using a development server.
"""

from os import environ
from FlaskWebProject1 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, threaded=True)
Example #6
0
"""
This script runs the FlaskWebProject1 application using a development server.
"""
from os import environ
from FlaskWebProject1 import app
#from flask.ext.socketio import SocketIO, emit

#socketio = SocketIO(app)

if __name__ == '__main__':
    HOST = environ.get('SERVER_HOST', 'localhost')
    #try:
        #PORT = int(environ.get('SERVER_PORT', '5555'))
    #except ValueError:
    PORT = 5000
    app.run(HOST, PORT, debug=True)
    #server = SocketIOServer(('127.0.0.1', 5000), app, resource='test', policy_server=False)
    #server.serve_forever()
    #socketio.run(app), HOST, 5000, resource="test")
Example #7
0
author: Sebastian Wolf
description: This is a flask app giving the ability to scrobble
    last.fm tracks from BBC Radio Shows

"""
__author__ = "Sebastian Wolf"
__copyright__ = "Copyright 2017, BBCAfterSCrobbler"
__license__ = "https://www.apache.org/licenses/LICENSE-2.0"
__version__ = "0.0.1"
__maintainer__ = "Sebastian Wolf"
__email__ = "*****@*****.**"
__status__ = "Production"

from os import environ
from FlaskWebProject1 import app
import logging

if __name__ == '__main__':
    HOST = environ.get('SERVER_HOST', 'localhost')
    try:
        PORT = int(environ.get('SERVER_PORT', '5555'))
    except ValueError:
        PORT = 5555
    import logging

    handler = logging.FileHandler('app.log')  # errors logged to this file
    handler.setLevel(logging.WARN)  # only log errors and above
    app.debug = True
    app.logger.addHandler(handler)
    app.run(HOST, PORT, debug=True)
Example #8
0
"""
This script runs the FlaskWebProject1 application using a development server.
"""

from os import environ
from FlaskWebProject1 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, debug='true')
"""
if __name__== '__main__':
    app.run(debug='true')
"""
"""
This script runs the FlaskWebProject1 application using a development server.
"""

from os import environ
from FlaskWebProject1 import app

if __name__ == '__main__':
    HOST = environ.get('SERVER_HOST', '192.168.0.104')
    try:
        PORT = int(environ.get('SERVER_PORT', '80'))
    except ValueError:
        PORT = 80
    app.run(HOST, PORT)
Example #10
0
"""
This script runs the FlaskWebProject1 application using a development server.
"""

from os import environ
from FlaskWebProject1 import app
import socket

if __name__ == '__main__':
    #HOST = environ.get('SERVER_HOST', 'localhost')
    hostname = socket.gethostname()
    ip = socket.gethostbyname(hostname)
    print(ip)
    app.run(ip, 5555)
"""
This script runs the FlaskWebProject1 application using a development server.
"""

from os import environ
from FlaskWebProject1 import app

if __name__ == '__main__':
    HOST = environ.get('SERVER_HOST', 'localhost')

    # Port needs to be specified at https://apps.dev.microsoft.com/ in order to work, hence can't change
    app.run(HOST, 5000)
Example #12
0
    """Renders the about page."""
    resp = twiml.Response()
    resp.message("Hi!")

    return render_template('about.html')


@app.route('/services')
def services():
    """Renders the about page."""

    return render_template('services.html')


if __name__ == "__main__":
    app.run()


# Returns the forecast for a given geographical location expressed in cooridates (latitude and longitude)
# Might also return predictions.
# The output of this function is to be directly sent as the body of an SMS message
def get_forecast(lat, lon):
    """
    Input: the latitude and longitude of a location
    Outout: the weather forecast for that location

    Uses a weather api to return the hourly predicted rain and temperature values for the next few days
    """

    # TODO: Remove these when we are done testing
    lat = -1.29
Example #13
0
"""
This script runs the FlaskWebProject1 application using a development server.
"""

from os import environ
from FlaskWebProject1 import app

app.run(port=5000, debug=True)


def method_name():
    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)
Example #14
0
"""
This script runs the FlaskWebProject1 application using a development server.
"""

from os import environ
from FlaskWebProject1 import app as application

if __name__ == '__main__':
    HOST = environ.get('SERVER_HOST', 'localhost')
    try:
        PORT = int(environ.get('SERVER_PORT', '8000'))
    except ValueError:
        PORT = 8000
    application.run(HOST, PORT)