diff --git a/docs/topics/commands.rst b/docs/topics/commands.rst index 9a40a2c29..d7999900b 100644 --- a/docs/topics/commands.rst +++ b/docs/topics/commands.rst @@ -159,6 +159,7 @@ settings). Global commands: * :command:`startproject` +* :command:`genspider` * :command:`settings` * :command:`runspider` * :command:`shell` @@ -173,7 +174,6 @@ Project-only commands: * :command:`list` * :command:`edit` * :command:`parse` -* :command:`genspider` * :command:`bench` .. command:: startproject @@ -197,14 +197,9 @@ genspider --------- * Syntax: ``scrapy genspider [-t template] `` -* Requires project: *yes* +* Requires project: *no* -Create a new spider in the current project. - -This is just a convenience shortcut command for creating spiders based on -pre-defined templates, but certainly not the only way to create spiders. You -can just create the spider source code files yourself, instead of using this -command. +Create a new spider in the current folder or in the current project's ``spiders`` folder, if called from inside a project. The ```` parameter is set as the spider's ``name``, while ```` is used to generate the ``allowed_domains`` and ``start_urls`` spider's attributes. Usage example:: @@ -215,22 +210,16 @@ Usage example:: csvfeed xmlfeed - $ scrapy genspider -d basic - import scrapy + $ scrapy genspider example example.com + Created spider 'example' using template 'basic' - class $classname(scrapy.Spider): - name = "$name" - allowed_domains = ["$domain"] - start_urls = ( - 'http://www.$domain/', - ) + $ scrapy genspider -t crawl scrapyorg scrapy.org + Created spider 'scrapyorg' using template 'crawl' - def parse(self, response): - pass - - $ scrapy genspider -t basic example example.com - Created spider 'example' using template 'basic' in module: - mybot.spiders.example +This is just a convenience shortcut command for creating spiders based on +pre-defined templates, but certainly not the only way to create spiders. You +can just create the spider source code files yourself, instead of using this +command. .. command:: crawl