如何让我的应用程序在appengine上工作

时间:2013-11-13 19:17:00

标签: php mysql google-app-engine

我以通常的方式开发了一个Web应用程序,并托管在普通的共享服务器上。

这就是我通常的意思

  • 包含我的PHP函数文件(使用php include / require)
  • 使用我的普通MySQL数据库和msqli
  • 使用FTP将我的文件正常上传到服务器。

由于某些原因,我需要将Web应用程序移动到appengine,我已成功上传文件,但它显示了这个错误:

500 Server Error

我的日志中出现此错误:

Traceback (most recent call last):
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 239, 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 298, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 84, in LoadObject
    obj = __import__(path[0])
ImportError: No module named index

我需要对文件进行哪些更改才能使我的网站在没有问题的情况下正常运行?

编辑(app.yaml的内容)

application: gcdc2013-myworkset
version: 1
runtime: python27
api_version: 1
threadsafe: yes

handlers:
- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico

- url: .*
  script: index.php

- url: /css
  static_dir: stylesheets

- url: /images
  static_dir: images

libraries:
- name: webapp2
  version: "2.5.2"

我尝试将运行时更改为php,但它给出了一个错误,立即清除我将其更改回python27

修改

更新了app.yaml文件(项目现在部署但显示所有PHP文件的此错误:Could not guess mimetype for excel/excel_reader.php. Using application/octet-stream.  在浏览器上查看时,该项目显示为空白:

application: gcdc2013-myworkset
version: 1
runtime: php
api_version: 1

handlers:
- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico

- url: .*
  script: index.php

- url: /
  script: index.php

- url: /index\.php
  script: index.php

- url: /features
  script: features/index.php

- url: /about
  script: about/index.php

- url: /oauth2callback/?
  script: signup.php  

- url: (.*)\.[\d]{10}\.(css|js)
  static_files: $1.$2
  upload: (.*).(.*)

- url: /css
  static_dir: css

- url: /js
  static_dir: js

另外,如何导入我从localhost导出的mysql数据库到appengine?

1 个答案:

答案 0 :(得分:2)

变化:

runtime: python27

要:

runtime: php

并删除:

libraries:
- name: webapp2
  version: "2.5.2"

有关详细信息,请参阅https://developers.google.com/appengine/docs/php/config/appconfig