我已经构建了一个托管在App Engine上的博客,我想实现降价。我在Github上查找后安装了markdown2模块,我可以在终端控制台中使用它。
但是当我尝试在我的程序中导入相同的模块时,我遇到一个错误,指出没有这样的模块。我甚至尝试使用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
答案 0 :(得分:2)
本地计算机上的第三方库不会自动包含在Google App Engine中。
您必须将这些库直接添加到源代码中。这些主题详细解释了如何执行此操作:
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?
答案 1 :(得分:0)
在应用程序文件夹中复制并粘贴'markdown'源代码文件夹。它会起作用。