from flask import render_template, abort from octopus.lib.webapp import custom_static @app.route("/") def root(): return render_template("index.html") # this allows us to override the standard static file handling with our own dynamic version @app.route("/static/<path:filename>") def static(filename): return custom_static(filename) # this allows us to serve our standard javascript config from octopus.modules.clientjs.configjs import blueprint as configjs app.register_blueprint(configjs) # Autocomplete endpoint from octopus.modules.es.autocomplete import blueprint as autocomplete app.register_blueprint(autocomplete, url_prefix='/autocomplete') from octopus.modules.crud.api import blueprint as crud app.register_blueprint(crud, url_prefix="/api") from octopus.modules.es.query import blueprint as query app.register_blueprint(query, url_prefix="/query") from octopus.modules.clientjs.fragments import blueprint as fragments app.register_blueprint(fragments, url_prefix="/frag") @app.route("/form")
return "Wrong # of lines returned by supervisorctl for {0}, double check the command and correct the service.web.health code.".format( supervisord_process_name) if 'RUNNING' in output: return True # this allows us to override the standard static file handling with our own dynamic version @app.route("/static/<path:filename>") def static(filename): return custom_static(filename) # this allows us to serve our standard javascript config from octopus.modules.clientjs.configjs import blueprint as configjs app.register_blueprint(configjs) # Autocomplete endpoint from octopus.modules.es.autocomplete import blueprint as autocomplete app.register_blueprint(autocomplete, url_prefix='/autocomplete') # OAGR monitor endpoint from octopus.modules.oag.monitor import blueprint as oagmonitor app.register_blueprint(oagmonitor, url_prefix='/oagr') # Query Endpoint from octopus.modules.es.query import blueprint as query app.register_blueprint(query, url_prefix="/query") @app.errorhandler(404)
output = subprocess.check_output(["sudo", "supervisorctl", "status", supervisord_process_name]) if len(output.splitlines()) != 1: return "Wrong # of lines returned by supervisorctl for {0}, double check the command and correct the service.web.health code.".format(supervisord_process_name) if 'RUNNING' in output: return True # this allows us to override the standard static file handling with our own dynamic version @app.route("/static/<path:filename>") def static(filename): return custom_static(filename) # this allows us to serve our standard javascript config from octopus.modules.clientjs.configjs import blueprint as configjs app.register_blueprint(configjs) # Autocomplete endpoint from octopus.modules.es.autocomplete import blueprint as autocomplete app.register_blueprint(autocomplete, url_prefix='/autocomplete') # OAGR monitor endpoint from octopus.modules.oag.monitor import blueprint as oagmonitor app.register_blueprint(oagmonitor, url_prefix='/oagr') # Query Endpoint from octopus.modules.es.query import blueprint as query app.register_blueprint(query, url_prefix="/query") @app.errorhandler(404) def page_not_found(e):
if request.method == "GET": return render_template("set.html") elif request.method == "POST": data = json.loads(request.data) e = Exercise(data) return render_template("_track_set.html", exercise=e) # this allows us to override the standard static file handling with our own dynamic version @app.route("/static/<path:filename>") def static(filename): return custom_static(filename) # this allows us to serve our standard javascript config from octopus.modules.clientjs.configjs import blueprint as configjs app.register_blueprint(configjs) # Autocomplete endpoint from octopus.modules.es.autocomplete import blueprint as autocomplete app.register_blueprint(autocomplete, url_prefix='/autocomplete') from octopus.modules.crud.api import blueprint as crud app.register_blueprint(crud, url_prefix="/api") from octopus.modules.es.query import blueprint as query app.register_blueprint(query, url_prefix="/query") from octopus.modules.clientjs.fragments import blueprint as fragments app.register_blueprint(fragments, url_prefix="/frag") @app.errorhandler(404)
initialise() # most of the imports should be done here, after initialise() from flask import render_template from octopus.lib.webapp import custom_static @app.route("/") def index(): return render_template("demo.html") # this allows us to override the standard static file handling with our own dynamic version @app.route("/static/<path:filename>") def static(filename): return custom_static(filename) # this allows us to serve our standard javascript config from octopus.modules.clientjs.configjs import blueprint as configjs app.register_blueprint(configjs) from octopus.modules.es.query import blueprint as query app.register_blueprint(query, url_prefix="/query") if __name__ == "__main__": app.run(host='0.0.0.0', debug=app.config['DEBUG'], port=app.config['PORT'], threaded=False)
@app.route("/report/institution") def institution(): return render_template("institution.html") @app.route("/report/oavshybrid") def oavshybrid(): return render_template("oavshybrid.html") @app.route("/report/goldgreen") def goldgreen(): return render_template("goldgreen.html") # mount the blueprint for the duplicates page from service.view.duplicates import blueprint as dup_page app.register_blueprint(dup_page) @app.route("/dates") @jsonp def dates(): stats = dao.InstitutionalRecordDAO.date_statistics() resp = make_response(json.dumps(stats)) resp.mimetype = "application/json" return resp # this allows us to override the standard static file handling with our own dynamic version @app.route("/static/<path:filename>") def static(filename): return custom_static(filename) from octopus.modules.clientjs.configjs import blueprint as configjs
return render_template("institution.html") @app.route("/report/oavshybrid") def oavshybrid(): return render_template("oavshybrid.html") @app.route("/report/goldgreen") def goldgreen(): return render_template("goldgreen.html") # mount the blueprint for the duplicates page from service.view.duplicates import blueprint as dup_page app.register_blueprint(dup_page) @app.route("/dates") @jsonp def dates(): stats = dao.InstitutionalRecordDAO.date_statistics() resp = make_response(json.dumps(stats)) resp.mimetype = "application/json" return resp # this allows us to override the standard static file handling with our own dynamic version @app.route("/static/<path:filename>") def static(filename): return custom_static(filename)
return send_file(cf.path, mimetype="text/csv", as_attachment=True, attachment_filename=cf.filename + ".csv") # this allows us to override the standard static file handling with our own dynamic version @app.route("/static/<path:filename>") def static(filename): return custom_static(filename) # this allows us to serve our standard javascript config from octopus.modules.clientjs.configjs import blueprint as configjs app.register_blueprint(configjs) # mount the crud and the search at the same root from octopus.modules.crud.api import blueprint as crud app.register_blueprint(crud, url_prefix="/api") from octopus.modules.es.searchapi import blueprint as searchapi app.register_blueprint(searchapi, url_prefix="/api") from octopus.modules.es.query import blueprint as query app.register_blueprint(query, url_prefix="/query") app.register_blueprint(query, url_prefix="/account_query")
app.config['DEBUG'] = False import pydevd pydevd.settrace(app.config.get('DEBUG_SERVER_HOST', 'localhost'), port=app.config.get('DEBUG_SERVER_PORT', 51234), stdoutToServer=True, stderrToServer=True) print "STARTED IN REMOTE DEBUG MODE" initialise() # most of the imports should be done here, after initialise() from flask import render_template from octopus.lib.webapp import custom_static @app.route("/") def index(): return render_template("demo.html") # this allows us to override the standard static file handling with our own dynamic version @app.route("/static/<path:filename>") def static(filename): return custom_static(filename) # this allows us to serve our standard javascript config from octopus.modules.clientjs.configjs import blueprint as configjs app.register_blueprint(configjs) from octopus.modules.es.query import blueprint as query app.register_blueprint(query, url_prefix="/query") if __name__ == "__main__": app.run(host='0.0.0.0', debug=app.config['DEBUG'], port=app.config['PORT'], threaded=False)
Project(url="url1", name="Project1"), Project(url="url2", name="Project2"), Project(url="url3", name="Project3") ] #Project.new(url="foo", name="boo")] return render_template("projects.html", projects=projects) # this allows us to override the standard static file handling with our own dynamic version @app.route("/static/<path:filename>") def static(filename): return custom_static(filename) # this allows us to serve our standard javascript config from octopus.modules.clientjs.configjs import blueprint as configjs app.register_blueprint(configjs) @app.errorhandler(404) def page_not_found(e): return render_template('errors/404.html'), 404 if __name__ == "__main__": app.run(host='0.0.0.0', debug=app.config['DEBUG'], port=app.config['PORT'], threaded=False)
@app.route("/") def root(): journal = request.values.get("journal", "") funders = request.values.get("funders", "") funders = [f for f in funders.split(",") if f != ""] return render_template("index.html", journal=journal, funders=funders) # this allows us to override the standard static file handling with our own dynamic version @app.route("/static/<path:filename>") def static(filename): return custom_static(filename) # this allows us to serve our standard javascript config from octopus.modules.clientjs.configjs import blueprint as configjs app.register_blueprint(configjs) from octopus.modules.es.autocomplete import blueprint as autocomplete app.register_blueprint(autocomplete, url_prefix='/autocomplete') from octopus.modules.sherpafact.proxy import blueprint as fact app.register_blueprint(fact, url_prefix="/fact") #from octopus.modules.examples.examples import blueprint as examples #app.register_blueprint(examples, url_prefix="/examples") @app.route("/faq") def faq(): return render_template("faq.html") @app.route("/api")
@app.route("/") def index(): return render_template("index.html") # this allows us to override the standard static file handling with our own dynamic version @app.route("/static/<path:filename>") def static(filename): return custom_static(filename) @app.route("/fonts/<path:filename>") def fonts(filename): return redirect(url_for("static", filename=u"fonts/{x}".format(x=filename))) # this allows us to serve our standard javascript config from octopus.modules.clientjs.configjs import blueprint as configjs app.register_blueprint(configjs) from octopus.modules.crud.api import blueprint as crud app.register_blueprint(crud, url_prefix="/api/v1") from octopus.modules.es.query import blueprint as query app.register_blueprint(query, url_prefix="/account_query") app.register_blueprint(query, url_prefix="/query") from octopus.modules.es.searchapi import blueprint as search app.register_blueprint(search, url_prefix="/search/v1") # adding account management, which enables the login functionality from octopus.modules.account.account import blueprint as account app.register_blueprint(account, url_prefix="/account")