【问题标题】:Can anyone correct my app.yaml and cron.yaml? Google cloud platform任何人都可以更正我的 app.yaml 和 cron.yaml 吗?谷歌云平台
【发布时间】:2017-07-23 02:36:56
【问题描述】:

我有一个python代码scrape.py,我想在应用引擎上运行它,它存储在我的存储库中,库都在文件夹lib中。

谁能更正我的 app.yaml 和 cron.yaml。

我的进口

import requests
import re
import mysql.connector
from urlparse import urlparse
from urlparse import urljoin
from bs4 import BeautifulSoup

app.yaml

runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /
  script: Scrape.app

handlers:
- url: /lib/requests
  script: Scrape.app

handlers:
- url: /requests
  script: Scrape.app

handlers:
- url: /mysql/connector
  script: Scrape.app

handlers:
- url: /bs4/
  script: Scrape.app

处理程序: - 网址:/lib/mysql/connector 脚本:Scrape.app

handlers:
- url: /lib/bs4/
  script: Scrape.app

cron.yaml

cron:
- description: "Scrape"
  url: /
  schedule: every 10 mins
  retry_parameters:
    min_backoff_seconds: 2.5
    max_doublings: 10

我注意到我的 cron.yaml 有效,因为在我的应用引擎统计信息中,每 10m 有一个活动,但我不知道每 10m 运行一次代码是否正确。

错误


Updating service [default]...failed.                                                                                                                                                                                                          
ERROR: (gcloud.app.deploy) Error Response: [9] 
Application startup error:
/bin/sh: 1: Python: not found

Traceback (most recent call last):
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 240, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 85, in LoadObject
    obj = __import__(path[0])
  File "/base/data/home/apps/s~tribal-bonito-157700/20170302t182530.399552845921654287/Scrape.py", line 3, in <module>
    import requests
ImportError: No module named requests

【问题讨论】:

标签: google-app-engine cron repository google-cloud-platform app.yaml


【解决方案1】:

您的cron.yaml 目标/,但app.yaml 中没有/ 的处理程序。

您说统计数据显示活动。日志是否显示错误?

【讨论】:

  • 是的,日志显示错误,例如找不到 python。但我注意到应用引擎上的图表每 10m 上升一次
  • @Boneyflesh 你在 lib 文件夹中安装了requests 库吗?
  • @AvinashRaj 是的,我做到了,事实上我使用 pip 将其安装在 lib 目录中,然后将其添加到我的 git 存储库中。
猜你喜欢
  • 2021-04-27
  • 2019-05-26
  • 2018-08-25
  • 2020-12-11
  • 2020-06-02
  • 1970-01-01
  • 2020-12-18
  • 2018-11-23
  • 1970-01-01
相关资源
最近更新 更多