嘗試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