我正在Mac上使用GoogleAppEngineLauncher浏览GAE webapp2教程(运行时2.7),虽然我正在完全遵循所有内容,但我在导入Jinja2模块时仍然出现错误:使用模板 - Google App Engine
错误:
回溯(最近一次调用最后一次):文件"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py",第168行,在Handle处理程序中= _config_handle.add_wsgi_middleware(self._LoadHandler())文件"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py",第206行, in _LoadHandler handler = import(path [0])File"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py",第640行,在Decorate return func(self,*args,**kwargs)文件"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py",第1756行,在load_module中返回self.FindAndLoadModule(submodule,fullname,search_path)文件"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py",第640行,在Decorate return func( self,*args,**kwargs)在FindAndLoadModule中输入文件"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py",第1628行描述)文件"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py",第640行,装饰返回功能(self,*args ,**kwargs)文件"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py",第1571行,在LoadModuleRestricted说明中)文件"/用户/ ykessler/Dropbox/appgrinders/gae_apps/helloworld2.7/helloworld.py",第9行,导入jinja2 ImportError:没有名为jinja2的模块
所以它出于某种原因无法找到该模块,即使它应该被打包为webapp2的附加功能的一部分.当我在我的文件系统上搜索时,它看起来像是在那里:
/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2_extras/jinja2.py
Run Code Online (Sandbox Code Playgroud)
如果我将应用程序部署到GAE,它可以正常工作.为什么会在本地失败?
什么时候应该在javascript中使用对象文字,有时我会感到困惑我试图将oop概念和模式应用于语言.我试图不仅仅使用过程编程概念,因为我知道该语言具有惊人的功能.
有没有将Flex/Flash项目编译成Javascript/JQuery的选项?我似乎记得这个功能可能是Adobe最新开发工具的一部分吗?
我有一个简单的脚本,我将获取一个HTML页面,将其传递给BeautifulSoup以删除所有脚本和样式标记,然后我想将HTML结果传递给另一个方法.是否有捷径可寻?略读BeautifulSoup.py,我还没有看到它.
soup = BeautifulSoup(html)
for script in soup("script"):
soup.script.extract()
for style in soup("style"):
soup.style.extract()
contents = soup.html.contents
text = loader.extract_text(contents)
Run Code Online (Sandbox Code Playgroud)
contents = soup.html.contents只获取一个列表,所有内容都在类中定义.是否有一种方法只是在汤操作后返回原始html?或者我只是需要浏览contents列表并将html重新组合在一起,不包括脚本和样式标记?
或者是否有更好的解决方案来实现我想要的?
以下是否有任何区别?:
var object1= {
a: 0,
b: 1,
c: 2
};
Run Code Online (Sandbox Code Playgroud)
VS
var object2= {
'a': 0,
'b': 1,
'c': 2
};
Run Code Online (Sandbox Code Playgroud) 我有一个在Windows 7机器上运行的WAMP 2.2服务器,并且无法完成PHP错误记录.
即使我明确触发USER_ERROR错误或导致正常的ERROR错误,该文件也始终为空白.
我包含了php.ini文件的错误相关部分- 希望你能找到一些东西:
error_reporting = E_ALL
error_log = "c:/wamp32/logs/php_error.log" ;(UNCOMMENTED BY ME)
log_errors = On
display_errors = On
Run Code Online (Sandbox Code Playgroud) 我正在调试客户端的 3500行PHP文件.包含这个文件会导致PHP Parse error: syntax error, unexpected $end in ...错误,所以我假设某个地方有一个缺失的括号.是否有一个简单的工具或方法可以在线或在我正在使用的Komodo IDE中丢失大括号发现?
我刚刚更改了我的github仓库的名称,现在我的本地仓库(正如预期的那样)找不到它.如何更新名称,或者我应该将其视为新的远程仓库?
我正在尝试设置一个Heroku-ready Flask应用程序,但我无法弄清楚如何打开日志记录.
如果没有Foreman,我可以创建一个helloworld应用程序,如Flask教程中所述:
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
app.logger.debug('A value for debugging')
app.logger.warning('A value for warning')
return "Hello World!"
if __name__ == "__main__":
app.run(debug=True)
Run Code Online (Sandbox Code Playgroud)
像这样开始:
python hello.py
Run Code Online (Sandbox Code Playgroud)
并登录stdout.
但是,当我遵循Heroku教程时,没有app.run线:
import os
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
app.logger.debug('A value for debugging')
app.logger.warning('A value for warning')
return 'Hello World!'
Run Code Online (Sandbox Code Playgroud)
所以我无法弄清楚如何在调试模式下运行和/或获取日志输出:
foreman start -p 5000
Run Code Online (Sandbox Code Playgroud)
Procfile:
web: gunicorn hello:app
Run Code Online (Sandbox Code Playgroud) 我有一些可重复使用的HTML片段,我想在许多web2py视图中"包含".
使用具有LOAD的组件意味着必须编写需要加载其自己的数据的单独的控制器功能.
有办法:
javascript ×3
php ×2
python ×2
apache-flex ×1
debugging ×1
flash ×1
flask ×1
foreman ×1
git ×1
heroku ×1
html-parsing ×1
ide ×1
jquery ×1
macos ×1
procfile ×1
python-2.6 ×1
subviews ×1
syntax-error ×1
view ×1
wamp ×1
wampserver ×1
web2py ×1
webapp2 ×1