old_contents: # -*- coding: UTF-8 -*-
  from datetime import timedelta
  
  import os
  basedir = os.path.abspath(os.path.dirname(__file__))
  
  
  class Config(object):
      SECRET_KEY = os.environ.get('SECRET_KEY') or 'iVFJyTDbJdM'
      SQLALCHEMY_COMMIT_ON_TEARDOWN = True
      FLASKY_ADMIN = os.environ.get('FLASKY_ADMIN')
      SQLALCHEMY_TRACK_MODIFICATIONS = True
      SQLALCHEMY_RECORD_QUERIES = True
      FLASKY_DB_QUERY_TIMEOUT = 10
      DOUYU_MAIN_URL = 'http://www.douyutv.com'
      FLASKY_CHANNELS_PER_PAGE = 20
      FLASKY_ROOMS_PER_PAGE = 20
      CELERY_BROKER_URL = 'redis://localhost:6379/0'
      CELERY_RESULT_BACKEND = 'redis://localhost:6379/1'
      CELERY_TIMEZONE = 'UTC'
      CELERYBEAT_SCHEDULE = {
          'crawl-every-30-minutes': {
              'task': 'app.tasks.crawl_timed_task',
              'schedule': timedelta(minutes=30),
          }
      }
      CELERY_SUPERVISOR_LOGFILE = os.path.join(basedir, 'ghostdriver.log')
      CELERY_SUPERVISOR_INTERVAL = '15 mins'
      CELERY_SUPERVISOR_ROWCOUNT = 100
  
      @staticmethod
      def init_app(app):
          pass
  
  
  class DevelopmentConfig(Config):
      DEBUG = True
      SQLALCHEMY_DATABASE_URI = os.environ.get('DEV_DATABASE_URL') or 'sqlite:///{}'.format(os.path.join(basedir, 'data-dev.sqlite'))
  
  
  class TestingConfig(Config):
      TESTING = True
      SQLALCHEMY_DATABASE_URI = os.environ.get('TEST_DATABASE_URL') or 'sqlite:///{}'.format(os.path.join(basedir, 'data-test.sqlite'))
      WTF_CSRF_ENABLED = False
  
  
  class ProductionConfig(Config):
      SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or 'sqlite:///'.format(os.path.join(basedir, 'data.sqlite'))
  
      @staticmethod
      def init_app(app):
          Config.init_app(app)
          # set production log to file
          from logging import FileHandler, Formatter
          import logging
          filehd = FileHandler('tmp/production.log')
          fileformat = Formatter('%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s')
          filehd.setFormatter(fileformat)
          filehd.setLevel(logging.INFO)
          app.logger.addHandler(filehd)
  
  
  config = {
      'development': DevelopmentConfig,
      'testing': TestingConfig,
      'production': ProductionConfig,
  
      'default': DevelopmentConfig
  }
  
new_contents: # -*- coding: UTF-8 -*-
  from datetime import timedelta
  
  import os
  basedir = os.path.abspath(os.path.dirname(__file__))
  
  
  class Config(object):
      SECRET_KEY = os.environ.get('SECRET_KEY') or 'iVFJyTDbJdM'
      SQLALCHEMY_COMMIT_ON_TEARDOWN = True
      FLASKY_ADMIN = os.environ.get('FLASKY_ADMIN')
      SQLALCHEMY_TRACK_MODIFICATIONS = True
      SQLALCHEMY_RECORD_QUERIES = True
      FLASKY_DB_QUERY_TIMEOUT = 10
      DOUYU_MAIN_URL = 'http://www.douyutv.com'
      FLASKY_CHANNELS_PER_PAGE = 20
      FLASKY_ROOMS_PER_PAGE = 20
      CELERY_BROKER_URL = 'redis://localhost:6379/0'
      CELERY_RESULT_BACKEND = 'redis://localhost:6379/1'
      CELERY_TIMEZONE = 'UTC'
      CELERYBEAT_SCHEDULE = {
          'crawl-every-15-minutes': {
              'task': 'app.tasks.crawl_timed_task',
              'schedule': timedelta(minutes=15),
          }
      }
      CELERY_SUPERVISOR_LOGFILE = os.path.join(basedir, 'ghostdriver.log')
      CELERY_SUPERVISOR_INTERVAL = '15 mins'
      CELERY_SUPERVISOR_ROWCOUNT = 100
  
      @staticmethod
      def init_app(app):
          pass
  
  
  class DevelopmentConfig(Config):
      DEBUG = True
      SQLALCHEMY_DATABASE_URI = os.environ.get('DEV_DATABASE_URL') or 'sqlite:///{}'.format(os.path.join(basedir, 'data-dev.sqlite'))
  
  
  class TestingConfig(Config):
      TESTING = True
      SQLALCHEMY_DATABASE_URI = os.environ.get('TEST_DATABASE_URL') or 'sqlite:///{}'.format(os.path.join(basedir, 'data-test.sqlite'))
      WTF_CSRF_ENABLED = False
  
  
  class ProductionConfig(Config):
      SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or 'sqlite:///'.format(os.path.join(basedir, 'data.sqlite'))
  
      @staticmethod
      def init_app(app):
          Config.init_app(app)
          # set production log to file
          from logging import FileHandler, Formatter
          import logging
          filehd = FileHandler('tmp/production.log')
          fileformat = Formatter('%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s')
          filehd.setFormatter(fileformat)
          filehd.setLevel(logging.INFO)
          app.logger.addHandler(filehd)
  
  
  config = {
      'development': DevelopmentConfig,
      'testing': TestingConfig,
      'production': ProductionConfig,
  
      'default': DevelopmentConfig
  }
  
subject: modify crawler interval from 30 mins to 15 mins.