You need to create a CrawlerProcess inside your Flask application and start the crawl programmatically. See docs .
import scrapy from scrapy.crawler import CrawlerProcess class MySpider(scrapy.Spider):
Before moving on to the project, I advise you to look into the Python task queue (for example, rq ). This will allow you to run Scrapy crawls in the background and the Flask application will not hang while scrapes is running.
source share