提高开发效率:当更改代码后,不重启服务器就能使用新效果
参考链接:https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/001432339228196a8eb6fb8832b48b5aa0d740346536ead000
错误:
解决办法:
if __name__ == '__main__':
argv = sys.argv[1:]
if not argv:
print('Usage: ./pymonitor your-script.py')
exit(0)
if argv[0] != 'python3':
argv.insert(0, 'python3')
command = argv
path = os.path.abspath('.')
start_watch(path, None)
#替换为
if __name__ == '__main__':
argv = sys.argv[1:]
if not argv:
print('Usage: ./pymonitor your-script.py')
exit(0)
if argv[0] != 'python': # 这里用python不要用python3除非你的系统也是用python3 XX.PY来启动python程序的
argv.insert(0, 'python')
command = argv
path = os.path.abspath('.')
start_watch(path, None)
能在请求处理程序中返回html
参考链接:https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/001432339095180ce91c53cdab841bfa9c342a297b886fe000
@get('/')
def index(request):
users = yield from User.findAll()#查询所有用户信息,用于接下来输出
return {
'__template__': 'test.html',
'users': users
}
#下面是所有的test.html的代码
Test users - Awesome Python WebappAll users
{% for u in users %}
{{ u.name }} / {{ u.email }}
{% endfor %}
当用户在上面的输入框中键入字符时,会执行函数 "showHint()" 。该函数由 "onkeyup" 事件触发
参考链接:https://www.w3cschool.cn/ajax/ajax-asp-php.html
错误:
在用getElementById等寻找元素时,一定要让元素在
JavaScript 能够直接写入 HTML 输出流中:
您只能在 HTML 输出流中使用 document.write。
如果您在文档已加载后使用它(比如在函数中),会覆盖整个文档。
x=document.getElementById("demo"); // 找到元素
x.innerHTML="Hello JavaScript!";
document.write("
This is a heading
");document.write("
This is a paragraph.
");