title: How to add jobs to apscheduler via request using uwsgi + flask_apscheduler
body: <p>When run under Flask's local development server, jobs are added and run normally. When run under uWSGI, the job appears to get added to the job store but never is executed. A simple example with the described undesired behavior is given below:</p>
  
  <p><strong>__init__.py</strong></p>
  
  <pre><code>import flask
  from datetime import datetime, timedelta
  from flask_apscheduler import APScheduler
  
  app = flask.Flask("apscheduler_test")
  app.config["SCHEDULER_API_ENABLED"] = True
  scheduler = APScheduler()
  scheduler.init_app(app)
  scheduler.start()
  
  def test_job():
      print("test job run")
  
  @app.route("/test")
  def apscheduler_test():
      print("Adding Job")
      scheduler.add_job(id="101",
                        func=test_job,
                        next_run_time=(datetime.now() + timedelta(seconds=10)))
      return "view", 200
  
  if __name__ == '__main__':
      app.run(port=5050)
  </code></pre>
  
  <p><strong>apschedule_test.ini</strong></p>
  
  <pre><code>[uwsgi]
  pidfile = /var/run/%n.pid
  chdir = /opt/apscheduler
  master = true
  enable-threads = true
  threads = 20
  http-socket = :48197
  logto = /var/log/%n.log
  plugin = python3
  module = %n
  callable = app
  processes = 1
  uid = root
  gid = root
  daemonize = /var/log/apscheduler_test.log
  </code></pre>