我在服务器上配置了一个管理程序,如下所示:
[program:myproject]
command = /home/mydir/myproj/venv/bin/python /home/mydir/myproj/venv/bin/gunicorn manage:app -b <ip_address>:8000
directory = /home/mydir
我在我的虚拟环境中安装了gevent,但我不知道如何在supervisor command
变量上实现它,我可以通过终端手动运行它:
gunicorn manage:app -b <ip_address>:8000 --worker-class gevent
当我在supervisor命令中调用gevent时,我尝试包含一个路径,就像python和gunicorn一样,但它不起作用,老实说,我不知道执行gevent的正确目录/文件是什么,我也不确定是否这是在supervisor中执行worker类的正确方法。我在Ubuntu v14.04上运行
任何?谢谢
答案 0 :(得分:0)
已经为此做出了解决方案。但我不是100%肯定如果它是正确的,经过一百次搜索,我终于想出了一个有效的解决方案:)
从here得到了这个,我在项目目录中创建了一个gunicorn.conf.py文件,其中包含:
<table id="table1" cellspacing="0" cellpadding="0" border="0">
<tr>
<th style="width:150px">Product</th>
<th>Price ($)</th>
<th>Quantity</th>
<th>Amount ($)</th>
</tr>
<tbody data-bind='template: {name: "orderTemplate", foreach: lines}'></tbody>
</table>
<script type="text/html" id="orderTemplate">
<tr>
<td><select data-bind='options: products,
optionsText: "name",
value: "id",
optionsCaption:"--Select--",
value: product'>
</select>
</td>
<td data-bind='with: product'>
<span data-bind='text: formatCurrency(price)' ></span>
</td>
<td data-bind='with: product'>
<input data-bind='value: quantity' />
</td>
<td ><span data-bind='text: formatCurrency(subtotal())'></span></td>
</tr>
</script>
<script type="text/javascript">
var _products = [
{
"name": "1948 Porsche 356-A Roadster",
"price": 53.9,
"quantity": 1
},
{
"name": "1948 Porsche Type 356 Roadster",
"price": 62.16,
"quantity": 2
},
{
"name": "1949 Jaguar XK 120",
"price": 47.25,
"quantity": 1
},
{
"name": "1952 Alpine Renault 1300",
"price": 98.58,
"quantity": 1
},
{
"name": "1952 Citroen-15CV",
"price": 72.82,
"quantity": 1
},
{
"name": "1956 Porsche 356A Coupe",
"price": 98.3,
"quantity": 1
},
{
"name": "1957 Corvette Convertible",
"price": 69.93,
"quantity": 1
}];
function formatCurrency(value) {
return "$" + value.toFixed(2);
}
var CartLine = function () {
var self = this;
self.products = ko.observableArray(_products);
self.product = ko.observable(1);
self.price = ko.observable(1);
self.quantity = ko.observable(1); //default quantity value already defined in _products array
self.subtotal = ko.computed(function () {
//return self.product() ? self.product().price * parseInt("0" + self.product().quantity, 10) : 0;
return self.price() * self.quantity();
});
};
var Cart = function () {
// Stores an array of lines, and from these, can work out the grandTotal
var self = this;
self.lines = ko.observableArray([new CartLine()]); // Put one line in by default
};
ko.applyBindings(new Cart());
</script>
并将此文件集成到超级用户配置设置:
worker_class = 'gevent'
开始运行主管:
[program:myproject]
command = /home/mydir/myproj/venv/bin/python /home/mydir/myproj/venv/bin/gunicorn -c /home/mydir/myproj/gunicorn.conf.py manage:app -b <ip_address>:8000
directory = /home/mydir
噗!它已经在工作了!