How to run initialization for each gunicorn worker

I have a gunicorn application where I use several workers. I'm using the preload function so that all the configuration needed across the workers is done before the workers are spawned. What I'm struggling with is how to get the configuration run for the workers when they are spawned. I use sqlalchemy's create_engine, and I need to create and connect to this engine for each of the workers. For now I have this in the @before_first_request method, but this gives a too big delay for the first request to the application.

Heres some of my code:

init.py:

<all the relevant configuration for the app (across all workers)>
app = Flask(__name__) 
from . import views

views.py:

@app.before_first_request
def setup():
    engine = create_engine('postgresql://{}:{}@{}/{}'.format(db_user, db_pw, db_location, db_name),
                           connect_args={'connect_timeout': 10},
                           pool_recycle=3600)
    engine.connect()
    logger.info("Successfully created and connected to DB: " + str(engine))

What I want is to run the setup() when the worker is started, instead of on before_first_request. How can I achieve this?