尝试1:
directory = os.path.dirname (__file__)
path = os.path.join (directory, 'json', 'gitkit-server-config.json')
gitkit_instance = gitkitclient.GitkitClient.FromConfigFile (path)
尝试2:
directory = os.path.dirname (__file__)
path = os.path.join (directory, 'gitkit-server-config.json')
gitkit_instance = gitkitclient.GitkitClient.FromConfigFile (path)
获取开发服务器上下面的错误,以及生产服务器: (两次尝试中都有类似错误)
INFO 2014-08-29 14:34:21,621 module.py:642] default: "GET /_ah/warmup HTTP/1.1" 500 - ERROR 2014-08-29 09:04:26,540 wsgi.py:262]
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 239, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 298, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 84, in LoadObject
obj = __import__(path[0])
File "C:\gaurav\coding\python\myapp\myapp\main_v3.py", line 107, in
gitkit_instance = gitkitclient.GitkitClient.FromConfigFile (path)
File "C:\gaurav\coding\python\myapp\myapp\gitkitclient.py", line 193, in FromConfigFile
json_data = simplejson.load(open(config))
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\python\stubs.py", line 248, in init
raise IOError(errno.EACCES, 'file not accessible', filename)
IOError: [Errno 13] file not accessible: 'C:\gaurav\coding\python\myapp\myapp\json\gitkit-server-config.json'
INFO 2014-08-29 14:34:26,591 module.py:642] default: "GET /_ah/warmup HTTP/1.1" 500 -
app.yaml中的相关片段:
::
handlers:
# For Google Identity Toolkitv3 Oauth2
- url: /gitkit-server-config\.json
static_files: gitkit-server-config.json
upload: gitkit-server-config\.json
- url: /json
mime_type: application/json
static_dir: json
::
文件(“gitkit服务器-config.json')被复制并保存在两个地方:
C:\\gaurav\\coding\\python\\myapp\\myapp\\gitkit-server-config.json
C:\\gaurav\\coding\\python\\myapp\\myapp\\json\\gitkit-server-config.json
当我在网络浏览器中输入"http://www.myapp.com/gitkit-server-config.json"
,文件被下载。
我在做什么错?感谢你的帮助。
当一个文件被声明为静态的(应用程序:您可以配置“真application_readable” .yaml),你看不懂它!您必须创建一个非静态副本。 – voscausa 2014-08-29 14:01:07
@voscausa非常感谢。问题已解决。我修改了app.yaml的相关部分,如下所示:' - url:/ json mime_type:application/json static_dir:json application_readable:true' 请提供您的建议作为答案,我会接受它。 – gsinha 2014-08-29 14:16:15