title: Flask APScheduler production
body: <p>I am creating API in python-flask for first time. I am following this tutorial <a href="https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-uwsgi-and-nginx-on-ubuntu-16-04" rel="nofollow noreferrer">Link</a>. Everything is working fine and Flask-APScheduler too when I used nohup python. When I configured uWSGI and Nginx by tutorial my API is working but APScheduler doesnt work and I dont know why. Thank you for response.</p>
  
  <pre><code>wsgi.py
  zlty.ini
  config.py
  app
      __init__.py
      zlty.py
  </code></pre>
  
  <p>config.py</p>
  
  <pre><code>import os
  basedir = os.path.abspath(os.path.dirname(__file__))
  
  SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db')
  SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository')
  SQLALCHEMY_TRACK_MODIFICATIONS = False
  DEBUG = True
  APNS_CERTIFICATE = 'prodnopass.pem'
  APNS_SANDBOX = False
  JOBS = [
          {
              'id': 'first',
              'func': 'app.zlty:firstRoutes',
              'trigger': 'interval',
              'seconds': 120
          }, {
              'id': 'second',
              'func': 'app.zlty:secondRoutes',
              'trigger': 'interval',
              'seconds': 300
          }, {
              'id': 'third',
              'func': 'app.zlty:thirdRoutes',
              'trigger': 'interval',
              'seconds': 1860
          }
      ]   
  </code></pre>
  
  <p>wsgi.py</p>
  
  <pre><code>from app import app, scheduler, zlty
  
  if __name__ == "__main__":
      scheduler.start()
      app.run(host='0.0.0.0')
  </code></pre>
  
  <p><strong>init</strong>.py</p>
  
  <pre><code>from flask import Flask, request
  from flask_autodoc import Autodoc
  from flask_sqlalchemy import SQLAlchemy
  from flask_mail import Mail
  from flask_pushjack import FlaskAPNS
  from flask_apscheduler import APScheduler
  app = Flask(__name__)
  app.config.from_object('config')
  db = SQLAlchemy(app)
  auto = Autodoc(app)
  mail = Mail(app)
  clientapns = FlaskAPNS()
  clientapns.init_app(app)
  scheduler = APScheduler()
  scheduler.init_app(app)
  
  from app import zlty, models
  </code></pre>