Deploying python app with flask on ghost


i am running the latest version of ghost.


  • configuration was done with the ghost CLI on digital oceans server.
  • as per CLI install

I want to install a simple python application on to link to my below. I want Ghost to go to the api for the app at but i am unsure of how i need to configure my nginx setup or if it at all possible after i have used the ghost CLI install.


import flask
import numpy as np
import pickle
from flask import request

app = flask.Flask(name)
app.config[“DEBUG”] = False

@app.route(’/api/v1/predictor’, methods=[‘GET’])
def home():
if ‘age’ in request.args:
age = int(request.args[‘age’])
return “Error: No age field provided. Please specify.”

if 'n_eggs' in request.args:
    n_eggs = int(request.args['n_eggs'])
    return "Error: number of eggs not provided. Please specify."

if 'rank' in request.args:
    rank = int(request.args['rank'])
    return "Error: number of attempts at ivf not provided. Please specify."

pat = np.asarray([[age,n_eggs,rank]])
prediction = loadRFC1.predict_proba(pat)[0][1]

return f'<h1>Open IVF fert predictor</h1><p>At age {age} and with {n_eggs} eggs collected on your {rank} attemt you have {prediction} chance.</p>'

if name == ‘main’: