{"action":"created","issue":{"url":"https://api.github.com/repos/scrapy/scrapy/issues/1581","repository_url":"https://api.github.com/repos/scrapy/scrapy","labels_url":"https://api.github.com/repos/scrapy/scrapy/issues/1581/labels{/name}","comments_url":"https://api.github.com/repos/scrapy/scrapy/issues/1581/comments","events_url":"https://api.github.com/repos/scrapy/scrapy/issues/1581/events","html_url":"https://github.com/scrapy/scrapy/pull/1581","id":114874487,"number":1581,"title":"Make HttpCacheMiddleware work when outside project","user":{"login":"eliasdorneles","id":37565,"avatar_url":"https://avatars.githubusercontent.com/u/37565?v=3","gravatar_id":"","url":"https://api.github.com/users/eliasdorneles","html_url":"https://github.com/eliasdorneles","followers_url":"https://api.github.com/users/eliasdorneles/followers","following_url":"https://api.github.com/users/eliasdorneles/following{/other_user}","gists_url":"https://api.github.com/users/eliasdorneles/gists{/gist_id}","starred_url":"https://api.github.com/users/eliasdorneles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eliasdorneles/subscriptions","organizations_url":"https://api.github.com/users/eliasdorneles/orgs","repos_url":"https://api.github.com/users/eliasdorneles/repos","events_url":"https://api.github.com/users/eliasdorneles/events{/privacy}","received_events_url":"https://api.github.com/users/eliasdorneles/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-11-03T18:03:09Z","updated_at":"2016-02-03T13:22:57Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/scrapy/scrapy/pulls/1581","html_url":"https://github.com/scrapy/scrapy/pull/1581","diff_url":"https://github.com/scrapy/scrapy/pull/1581.diff","patch_url":"https://github.com/scrapy/scrapy/pull/1581.patch"},"body":"I ran into an issue trying to enable cache with `scrapy runspider`: the middleware gets disabled because it tries to create the `httpcache` directory inside a project data directory.\r\n\r\nThe [`utils.project.data_path`](https://github.com/scrapy/scrapy/blob/389882eb131250a1eb8418580b165625dd854bf0/scrapy/utils/project.py#L42) currently assumes that you're inside the project dir (maybe reasonably, since it's in the project module?).\r\n\r\nI know this solution breaks compatibility a little bit, but IMO it would be solving a bug.\r\n\r\nBtw, I noticed that this `data_path()` function is only being used by the HttpCacheMiddleware -- does it make sense to keep it as an util function?"},"comment":{"url":"https://api.github.com/repos/scrapy/scrapy/issues/comments/179226069","html_url":"https://github.com/scrapy/scrapy/pull/1581#issuecomment-179226069","issue_url":"https://api.github.com/repos/scrapy/scrapy/issues/1581","id":179226069,"user":{"login":"kmike","id":107893,"avatar_url":"https://avatars.githubusercontent.com/u/107893?v=3","gravatar_id":"","url":"https://api.github.com/users/kmike","html_url":"https://github.com/kmike","followers_url":"https://api.github.com/users/kmike/followers","following_url":"https://api.github.com/users/kmike/following{/other_user}","gists_url":"https://api.github.com/users/kmike/gists{/gist_id}","starred_url":"https://api.github.com/users/kmike/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmike/subscriptions","organizations_url":"https://api.github.com/users/kmike/orgs","repos_url":"https://api.github.com/users/kmike/repos","events_url":"https://api.github.com/users/kmike/events{/privacy}","received_events_url":"https://api.github.com/users/kmike/received_events","type":"User","site_admin":false},"created_at":"2016-02-03T13:22:57Z","updated_at":"2016-02-03T13:22:57Z","body":"A nice catch about scrapyd. It sounds like a bug fix though; I think we should make this change, but add a note about it."}}