コード例 #1
0
import logging
from flask import Flask
from flask_cors import CORS
from jobtech.common.customlogging import configure_logging
from sokannonser import appconf
from market.rest import api
# Import all Resources that are to be made visible for the app
from market.rest.endpoint import MarketSearch
from market.rest.endpoint import MarketComplete

app = Flask(__name__)
CORS(app)
configure_logging([__name__.split('.')[0], 'sokannonser', 'jobtech'])
log = logging.getLogger(__name__)
log.info(logging.getLevelName(log.getEffectiveLevel()) + ' log level activated')
log.info("Starting %s" % __name__)


if __name__ == '__main__':
    # Used only when starting this script directly, i.e. for debugging
    appconf.initialize_app(app, api)
    app.run(debug=True)
else:
    # Main entrypoint
    appconf.initialize_app(app, api)
コード例 #2
0
ファイル: application.py プロジェクト: perui/key-request
import logging
from jobtech.common.customlogging import configure_logging
from apikeys import app
from apikeys.repository import update_elastic, postgres
from flask import render_template, request, flash, abort, redirect

configure_logging([__name__.split(".")[0]])
log = logging.getLogger(__name__)
log.info(
    logging.getLevelName(log.getEffectiveLevel()) + ' log level activated')
log.info("Starting %s" % __name__)


@app.route('/', methods=['GET'])
def hello():
    available_apis = postgres.get_available_applications()
    return render_template('form.html', app_list=available_apis)


@app.route('/register', methods=['POST'])
def register():
    log.debug("Serving request for /register: %s" % request.values)
    email = request.form['email']
    appids = request.form.getlist('appid')
    application_name = request.form.get('applicationname')
    if not request.form.get('approve_gdpr', None):
        log.debug("User has not approved GDPR, sending back to base page")
        flash("You must approve our handling of your details.")
        return redirect("/")
    if not request.form.get('approve_license', None):
        log.debug("User has not approved license, sending back to base page")
コード例 #3
0
import logging
from flask import Flask
from flask_cors import CORS
from jobtech.common.customlogging import configure_logging
from sokannonser import appconf
from sokannonser.rest import api
# Import all Resources that are to be made visible for the app
from sokannonser.rest.endpoint.platsannonser import PBSearch, Proxy
# from sokannonser.rest.endpoint.openapi import OpenSearch
from sokannonser.rest.endpoint.valuestore import Valuestore
# from market.rest.endpoint import MarketComplete, MarketSearch

app = Flask(__name__)
CORS(app)
configure_logging([__name__.split('.')[0], 'market', 'bulkloader', 'jobtech', 'sokannonser'])
log = logging.getLogger(__name__)
log.info(logging.getLevelName(log.getEffectiveLevel()) + ' log level activated')
log.info("Starting %s" % __name__)


if __name__ == '__main__':
    # Used only when starting this script directly, i.e. for debugging
    appconf.initialize_app(app, api)
    app.run(debug=True)
else:
    # Main entrypoint
    appconf.initialize_app(app, api)