Home > Back-end >  How I can restart a venv Scrapy project
How I can restart a venv Scrapy project

Time:04-01

I am new in Scrapy, I just finished doing a project last night, how I can restart using the project again? I did run source venv/scripts/activate then the venv started but while I am running the scrapy crawl then I am getting an error

Scrapy 2.6.1 - no active project

Unknown command: crawl

Use "scrapy" to see available commands

Help please, thanks in advance.

CodePudding user response:

from scrapy docs:

To put our spider to work, go to the project’s top level directory and run:

scrapy crawl spider_name

CodePudding user response:

Most probably you are not running your Scrapy in correct directory:

Src: Link

Basically, a Scrapy project has a directory structure as:

tutorial/
    scrapy.cfg            # deploy configuration file

    tutorial/             # project's Python module, you'll import your code from here
        __init__.py

        items.py          # project items file

        pipelines.py      # project pipelines file

        settings.py       # project settings file

        spiders/          # a directory where you'll later put your spiders
            __init__.py
            ...

To put our spider to work, go to the project’s top level directory and run:

scrapy crawl spider_name

After you have created the project, you can now run scrapy from your project root folder. Make sure you are at the root of the project when you run scrapy.

Similar Question here: Link

Welcome, to the site. If the answer helps please upvote.

CodePudding user response:

I got it now, I wasn't in the project directory, I was in the another directory.

source venv/scripts/activate

then

cd/"your project directory"

It worked.

  • Related