Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8197441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:44:32+00:00 2026-06-07T05:44:32+00:00

I have a Flask web app, that shows information from a rss feed. I

  • 0

I have a Flask web app, that shows information from a rss feed. I want to process the rss feed regularly, e.g every 30 minutes. Extract some of the information and store it in a sqlite db.

But I can’t figure out how to schedule a function to certain intervals.

I have used the APScheduler, and my code is the following:

def main():
    # Start the scheduler
    filename = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'tmp')) + '\\' + 'spider.log'
    logging.basicConfig(filename=filename, level=logging.DEBUG,format='%(levelname)s[%(asctime)s]: %(message)s')
    sched = Scheduler()
    sched.start()
    sched.add_interval_job(run_job, minutes=30)
    time.sleep(9999)

I have a run.py function

from app import app, spider

spider.main()
app.run(debug=True)

The app.run(debug=True) starts the Flask web app. The problem is that the code never reaches app.run.

So is it possible to spawn another process to handle the spider.main() call, and run the process in the background? Or should I use another approach?

NB: I know I could use Flask-Celery, but for this small app, that seems too heavyweight…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T05:44:33+00:00Added an answer on June 7, 2026 at 5:44 am

    You don’t need time.sleep – when you run spider.main it starts your scheduler and then puts the process to sleep for 9999 seconds – after which it will run the next line. So app.run will start ~2.78 hours after spider.main started.

    So spider should look like this:

    def main():
        # Start the scheduler
        filename = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'tmp')) + '\\' + 'spider.log'
        logging.basicConfig(filename=filename, level=logging.DEBUG,format='%(levelname)s[%(asctime)s]: %(message)s')
        sched = Scheduler()
        sched.start()
        sched.add_interval_job(run_job, minutes=30)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a single page web app that shows real time data using just
I have a web app that uses a flash uploader (swfuploader) and recently a
I'm about to have to write a web page/app that will serve the agenda
I'm trying to build a web app that grabs fantasy sports info from Yahoo's
I have a generalized media player web app that I wish to be able
I have a C# winform app that is collecting some data from console-based commands.
I have a web app that prints reports, most are just one page, or
First off, The Problem: We have a Web App with a Flash front-end that
I have this simple Flask app: from flask import Flask import prolog_handler as p
I have a Flash web app which displays user submitted PNG files. Files are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.