我想要一个相当于Django One True Way设置布局:共享基本文件,然后是生产文件和开发文件,每个文件都导入共享库.
Pyramid的配置是否可以实现?
自从使用 Windows 2020 年 4 月 10 日更新从 WSL 1 更新到 WSL 2(然后将 Ubuntu 18 更新到 Ubuntu 20)以来,nodemon当项目目录中的文件发生更改时,我一直无法进行热重载。当我对.js文件进行任何更改时,不会重新启动服务器或在终端输出:
我用nodemon这样的方式启动我的 Node.js 服务器:
NODE_ENV=development DEBUG='knex:*' nodemon --verbose --inspect ./server.js"
Run Code Online (Sandbox Code Playgroud)
如果它有用,这是我的server.js:
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`Server started and listening on port ${PORT}`);
});
Run Code Online (Sandbox Code Playgroud)
我什至不确定如何进一步解决此问题以获取有关正在发生的事情的更多有用信息。
node.js nodemon windows-subsystem-for-linux wsl-2 ubuntu-20.04
在使用jsTree构建的树中,我将<a>标记中的文本放在变量中.我想检查那个节点.我怎么能这样做?
我目前正在使用jQuery找到该节点,并改变其类.但是,这不会通过使父类在其类中未确定来修复父节点.我尝试过$('.colors').jstree("checkbox_repair"),但似乎没有做任何事情.
如果有人能够真正回答这两个问题,那将会很棒,因为它们与同一个问题有关.
这是一个jsFiddle,说明问题 - > http://jsfiddle.net/thapar/5XAjU/
我有以下视图代码,试图将zip文件"流"到客户端进行下载:
import os
import zipfile
import tempfile
from pyramid.response import FileIter
def zipper(request):
_temp_path = request.registry.settings['_temp']
tmpfile = tempfile.NamedTemporaryFile('w', dir=_temp_path, delete=True)
tmpfile_path = tmpfile.name
## creating zipfile and adding files
z = zipfile.ZipFile(tmpfile_path, "w")
z.write('somefile1.txt')
z.write('somefile2.txt')
z.close()
## renaming the zipfile
new_zip_path = _temp_path + '/somefilegroup.zip'
os.rename(tmpfile_path, new_zip_path)
## re-opening the zipfile with new name
z = zipfile.ZipFile(new_zip_path, 'r')
response = FileIter(z.fp)
return response
Run Code Online (Sandbox Code Playgroud)
但是,这是我在浏览器中获得的响应:
Could not convert return value of the view callable function newsite.static.zipper into a response object. …
我在做:
z = zipfile.ZipFile('myzip.zip', 'w')
z.write('/some/path/mytxt1.txt')
z.write('/some/other/path/mytxt2.txt')
z.close()
Run Code Online (Sandbox Code Playgroud)
这是在zip文件中保留文件路径。我只希望将所需文件放在zip文件中。我怎样才能做到这一点?
python ×3
pyramid ×2
ini ×1
javascript ×1
jquery ×1
jstree ×1
node.js ×1
nodemon ×1
paster ×1
python-paste ×1
ubuntu-20.04 ×1
windows-subsystem-for-linux ×1
wsl-2 ×1