dev_appserver.py不识别我的文件
我正在尝试在Windows 7上运行一个基本的GAE(Google App Engine)教程。
到目前为止,我已经做了以下几件事:
- 安装了Python 2.5.4
- 安装了最新的GAE SDK
- 设置了我的PATH变量,以包含Python和GAE的路径
- 按照要求创建了一个“你好,世界”的应用,包含app.yaml和main.py文件。
当我在应用的目录中运行dev_appserver.py .
或者在应用上一级目录中运行dev_appserver.py DIRECTORY_NAME
时,我收到了错误信息:
无效的参数
应用根目录必须是要在此服务器上运行的应用的路径。 必须包含一个有效的app.yaml或 app.yml文件。
[接下来是一堆dev_appserver.py的选项]
我哪里做错了?据我所知,我已经正确配置了一切。
3 个回答
0
选择任何一个 .py 文件,然后按下 alt + enter(或者右键点击文件选择 属性),接着选择 更改,然后从安装目录中选择 python.exe(应用程序)来打开 .py 文件,最后运行你的文件... ;-p
1
这是一个非常基础的例子:
alfred@alfred-laptop:~/gae/test$ cat /etc/issue
Ubuntu 10.10 \n \l
在终端中输入命令:
alfred@alfred-laptop:~/gae$ python --version
这条命令的意思是查看你电脑上安装的Python版本。运行后显示:
Python 2.6.6
alfred@alfred-laptop:~/gae$ pwd
/home/alfred/gae
alfred@alfred-laptop:~/gae$ ls -al
total 3444
drwxr-xr-x 4 alfred alfred 4096 2011-01-28 01:21 .
drwxr-xr-x 77 alfred alfred 4096 2011-01-28 01:23 ..
drwxr-xr-x 8 alfred alfred 4096 2010-12-16 00:06 google_appengine
-rw-r--r-- 1 alfred alfred 3506301 2011-01-28 01:21 google_appengine_1.4.1.zip
drwxr-xr-x 2 alfred alfred 4096 2011-01-28 01:24 test
alfred@alfred-laptop:~/gae$ ls google_appengine_1.4.1.zip
google_appengine_1.4.1.zip
alfred@alfred-laptop:~/gae/test$ cat app.yaml
application: helloworld
version: 1
runtime: python
api_version: 1
handlers:
- url: /.*
script: helloworld.py
alfred@alfred-laptop:~/gae/test$ cat helloworld.py
print 'Content-Type: text/plain'
print ''
print 'Hello, world!'
alfred@alfred-laptop:~/gae/google_appengine$ ./dev_appserver.py ~/gae/test/
/home/alfred/gae/google_appengine/google/appengine/tools/appcfg.py:42: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
import sha
/home/alfred/gae/google_appengine/google/appengine/tools/dev_appserver_login.py:33: DeprecationWarning: the md5 module is deprecated; use hashlib instead
import md5
INFO 2011-01-28 00:26:06,814 appengine_rpc.py:153] Server: appengine.google.com
INFO 2011-01-28 00:26:06,819 appcfg.py:414] Checking for updates to the SDK.
INFO 2011-01-28 00:26:07,014 appcfg.py:428] The SDK is up to date.
WARNING 2011-01-28 00:26:07,015 datastore_file_stub.py:573] Could not read datastore data from /tmp/dev_appserver.datastore
INFO 2011-01-28 00:26:07,047 dev_appserver_main.py:485] Running application helloworld on port 8080: http://localhost:8080
alfred@alfred-laptop:~/gae/test$ curl http://localhost:8080/
Hello, world!
2
我也遇到过同样的问题。
在 dev_appserver.py 前面加上 python.exe 解决了我的问题。
c:\Programme\Python27\python.exe C:\Programme\Google\AppEngineSDK\google_appengine\dev_appserver.py MoviesBwu\