建立一個專案

在開始使用 scrapy 之前,你必須啟動一個要儲存程式碼的專案。輸入目錄並執行此程式碼

scrapy startproject helloProject

該程式碼的第三部分是專案名稱。此程式碼將建立一個 helloProject 目錄,其中包含以下內容:

helloProject/
    scrapy.cfg            # deploy configuration file

    helloProject/         # 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