Python 文档声称,“不建议将 http.server 用于生产。它只实现基本的安全检查。”
是否有另一个简单易用的 python 服务器(如 http.server),具有“高级”安全检查,可以用于生产?
(我想在 Raspberri Pi 上运行 http 服务器,它将为静态网站提供服务)
谢谢!
我有 ExpressJS 服务器(在 NodeJS 中),它使用服务器发送的事件来宣布服务器数据库的更改。
我的 NodeJS 应用程序中的实际处理程序如下所示:
this._app.use((req, res, next) => {
if (req.url.includes("addDBListener")) {
res.writeHead(200, {
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache',
'Connection': 'keep-alive'
});
res.write('\n\n');
let path = (req.query && req.query.path) ? req.query.path : "";
this.dbListeners.push({
path: path,
res: res
});
}
else {
next();
}
});
Run Code Online (Sandbox Code Playgroud)
然后,当数据库发生任何更改时,我以这种方式向客户端发送信息(“i”是客户端的索引,我向其发送新信息):
this.clientDBListeners[i].res.write("data: " + JSON.stringify(DBPart) + "\n\n");
Run Code Online (Sandbox Code Playgroud)
在客户端,我用它来初始化(和处理)事件处理:
source = new EventSource('/addDBListener?path=' + dbPath)
let messageHandler = (e)=> {
console.log("DATAA: "+e.data);
}
let errorHandler = (e)=> {
//process error
console.log("ERROR!!!");
}
source.addEventListener('message', …Run Code Online (Sandbox Code Playgroud) 有没有办法在 SASS 模块中使用 Bootstrap SASS 变量?
例如,我的react/NextJS 项目中有文件index.module.scss。如何在 bootstrap 中使用 sass 模块变量?像这样的事情:
.hero{
color: $blue-200;
}
Run Code Online (Sandbox Code Playgroud)
如果我只是在文件开头添加此导入:
@import '~bootstrap/scss/bootstrap.scss';
Run Code Online (Sandbox Code Playgroud)
让我注意到,当我在非模块 sass 文件中使用此导入(假设在文件 index.scss 中)时,它会起作用。但我需要(想要)使用 SASS 模块......
知道如何解决吗?
谢谢!
bootstrap-5 ×1
css-modules ×1
express ×1
httpserver ×1
javascript ×1
next.js ×1
node.js ×1
python ×1
python-3.x ×1
reactjs ×1
sass ×1
security ×1
typescript ×1