Esempio n. 1
0
            'date': timems(),
            'lang': requested_lang(),
            'version': version(),
            'level': body['level'],
            'code': body['code'],
            'name': name,
            'server_error': error,
            'username': user['username']
        })
    program_count = 0
    if 'program_count' in user:
        program_count = user['program_count']
    db_set('users', {
        'username': user['username'],
        'program_count': program_count + 1
    })

    return jsonify({})


# *** AUTH ***

import auth
auth.routes(app, requested_lang)

# *** START SERVER ***

if __name__ == '__main__':
    # Threaded option to enable multiple instances for multiple user access support
    app.run(threaded=True, port=config['port'])
Esempio n. 2
0
sys.path.insert(0, './models')
from flask import Flask, jsonify, Response, request, send_from_directory
import members, auth, oauth, org

app = Flask(__name__)
app.config['UPLOAD_FOLDER'] = './tmp/'


@app.route('/', methods=['post', 'get'])
def index2():
    response = send_from_directory(directory='./view', filename='index.html')
    return response


members.routes(app)
auth.routes(app)
oauth.routes(app)
org.routes(app)

# @app.errorhandler(500)
# def err500(err):
#     response = flask.Response(jsonify({'err': err}), status= 500)
#     response.headers['Access-Control-Allow-Headers']='Content-Type'
#     response.headers['Access-Control-Allow-Origin']='*'
#     return response


@app.after_request
def setcores(response):
    response.headers['Access-Control-Allow-Origin'] = '*'
    # response.headers['Access-Control-Allow-Headers']='Content-Type'