我将 Flask 应用程序部署到了VPS,并使用 Gunicorn 作为Web服务器。 然后使用以下命令运行 Gunicorn 服务器:
{
"dynamicLinkInfo": {
"domainUriPrefix": "https://wi.page.link",
"link": "https://wiapp.com.au/faq?promocode=mypromo_code",
"iosInfo": {
"iosBundleId": "com.direce.sr",
"iosFallbackLink":"id1356389392",
"iosAppStoreId":"id1368389392",
},
"socialMetaTagInfo" :{
"socialImageLink":"https://vignette.wikia.nocookie.net/doraemon/images/b/b8/Doraemon_2005.PNG/revision/latest?cb=20151207094313&path-prefix=en",
"socialTitle":"my titu",
"socialDescription":"descripotio"
}
},
"suffix": {
"option":"UNGUESSABLE"
},
}
使用命令,我可以看到日志正在运行。但是,在关闭终端会话之后,我想再次查看正在运行的日志。
在Heroku中,我可以使用var doc, bod, M, T, I, S, Q; // for use on other loads
addEventListener('load', function(){
doc = document; bod = doc.body;
M = function(tag){
return doc.createElement(tag);
}
T = function(tag){
return doc.getElementsByTagName(tag);
}
I = function(id){
return doc.getElementById(id);
}
S = function(selector, within){
var w = within || doc;
return w.querySelector(selector);
}
Q = function(selector, within){
var w = within || doc;
return w.querySelectorAll(selector);
}
var sounds = {a:'clap', s:'hihat', d:'kick', f:'openhat', g:'boom', h:'ride', j:'snare', k:'tom', l:'tink'}, p, players = {};
for(var i in sounds){
p = M('audio'); p.src = 'sounds/'+sounds[i]+'.wav'; players[i] = p;
}
onkeydown = function(e){
players[e.key.toLowerCase()].play();
}
}); // end load
来执行此操作,以类似的方式在Gunicorn上查看它。
答案 0 :(得分:1)
您需要设置主管。主管使您的服务器保持运行模式并保存日志。在下面设置主管文件,然后您可以查看日志:
[program:your_project_name]
command=/home/your_virualenv/bin/gunicorn --log-level debug
run_apiengine:main_app --bind 0.0.0.0:5007 --workers 2 --worker-class gevent
directory=your_project_directory
stdout_logfile= your_log_folder_path/supervisor_stdout.log
stderr_logfile= your_log_folder_path/supervisor_stderr.log
user=your_user
autostart=true
PYTHONPATH="$PYTHONPATH:your_python_path";OAUTHLIB_INSECURE_TRANSPORT='1';