【发布时间】: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