2013-07-16 316 views
0

我已經構建了一個在App Engine上託管的博客,並且我想實施降價。在Github上查找它之後我已經安裝了他的markdown2模塊,我可以在終端控制檯中使用它。爲什麼我無法將markdown2導入到我的App Engine應用程序中?

但是,當我嘗試在我的程序中導入相同的模塊時,我遇到了一個錯誤,指出沒有這樣的模塊。我什至試圖使用sys.path方法,但我仍然得到錯誤。

爲我的錯誤回溯是:

File "/home/bigb/google_projects/google_appengine/google/appengine/runtime/wsgi.py", line 189, in Handle 
handler = _config_handle.add_wsgi_middleware(self._LoadHandler()) 
File "/home/bigb/google_projects/google_appengine/google/appengine/runtime/wsgi.py", line 227, in _LoadHandler 
handler = __import__(path[0]) 
File "/home/bigb/google_projects/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 676, in Decorate 
return func(self, *args, **kwargs) 
File "/home/bigb/google_projects/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 1859, in load_module 
return self.FindAndLoadModule(submodule, fullname, search_path) 
File "/home/bigb/google_projects/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 676, in Decorate 
return func(self, *args, **kwargs) 
File "/home/bigb/google_projects/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 1723, in FindAndLoadModule 
description) 
File "/home/bigb/google_projects/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 676, in Decorate 
return func(self, *args, **kwargs) 
File "/home/bigb/google_projects/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 1666, in LoadModuleRestricted 
description) 
File "/home/bigb/google_projects/my-ramblings/blog.py", line 12, in <module> 
import markdown2 

回答

2

本地計算機上的第三方庫不會自動包含在谷歌應用程序引擎。

您必須將這些庫直接添加到您的源代碼中。這些線程給出了詳細的解釋如何去這樣做:

1)How do I manage third-party Python libraries with Google App Engine? (virtualenv? pip?)

2)Uploading Python third party libraries

3)How to include third party Python libraries in Google App Engine?

+0

真的很有幫助,我已經知道我必須與sys混合才能將第三方庫導入到App Engine中,但我不知道該怎麼做。感謝這 – Bhargav

+0

不客氣:) – 2013-07-16 05:07:17

0

複製並粘貼到你的應用程序 '降價' 源代碼文件夾夾。它會工作。

相關問題