【问题标题】:django ping google http errordjango ping 谷歌 http 错误
【发布时间】:2014-10-23 05:21:20
【问题描述】:

我正在尝试 ping Google,但收到 HTTP 错误。为什么? env/bin/python manage.py ping_google [/sitemap.xml]

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/var/www/wen/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/var/www/wen/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/var/www/wen/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/var/www/wen/env/local/lib/python2.7/site-packages/django/contrib/sitemaps/management/commands/ping_google.py", line 13, in execute
    ping_google(sitemap_url=sitemap_url)
  File "/var/www/wen/env/local/lib/python2.7/site-packages/django/contrib/sitemaps/__init__.py", line 37, in ping_google
    urlopen("%s?%s" % (ping_url, params))
  File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 406, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 519, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 444, in error
    return self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 527, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 400: Bad Request

站点地图是我自己做的。

【问题讨论】:

  • 您是否按照此处所说的使用谷歌网站管理员工具注册了您的网站:docs.djangoproject.com/en/dev/ref/contrib/sitemaps/…
  • @StuartLeigh 我的网站在一天前被添加到网站管理员工具中。
  • 您是否尝试删除[]?所以它将是env/bin/python manage.py ping_google "/sitemap.xml"

标签: django ping http-error


【解决方案1】:

我刚刚跑了python manage.py '/sitemap.xml',没有出错

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-03
    • 2012-03-23
    • 2015-09-05
    相关资源
    最近更新 更多