2008-12-15 13:44:42 +00:00
=====================
Setting everything up
=====================
2008-12-16 00:39:48 +00:00
| In this tutorial, we'll teach you how to scrape http://www.google.com/dirhp; Google's web directory.
2008-12-15 13:44:42 +00:00
| We'll assume that you've checked and fulfilled the requirements specified in the Download page, and that Scrapy is already installed in your system.
For starting a new project, enter the directory where you'd like your project to be located, and run::
2008-12-16 00:39:48 +00:00
scrapy-admin.py startproject google
2008-12-15 13:44:42 +00:00
2008-12-16 00:39:48 +00:00
As long as Scrapy is well installed and the path is set, this should create a directory called "google"
2008-12-15 13:44:42 +00:00
containing the following files:
2008-12-16 00:39:48 +00:00
* *scrapy-ctl.py* - the project's control script. It's used for running the different tasks (like "genspider", "crawl" and "parse"). We'll talk more about this later.
2008-12-15 13:44:42 +00:00
* *scrapy_settings.py* - the project's settings file.
* *items.py* - were you define the different kinds of items you're going to scrape.
* *spiders* - directory where you'll later place your spiders.
* *templates* - directory containing some templates for newly created spiders, and where you can put your own.
| Ok, now that you have your project's structure defined, the last thing to do is to set your PYTHONPATH to your project's directory.
| You can do this by adding this to your .bashrc file:
::
export PYTHONPATH=/path/to/your/project
Now you can continue with the next part of the tutorial.