小编Joh*_*ohn的帖子

Gunicorn工人超时错误

我设置了gunicorn与3名工人30个工人连接并使用eventlet工人类.它是在Nginx背后设置的.在每几个请求之后,我在日志中看到了这一点.

[ERROR] gunicorn.error: WORKER TIMEOUT (pid:23475)
None
[INFO] gunicorn.error: Booting worker with pid: 23514
Run Code Online (Sandbox Code Playgroud)

为什么会这样?我怎么能弄清楚什么是错的?

谢谢

gunicorn

152
推荐指数
11
解决办法
10万
查看次数

Google如何识别没有空格的2个单词?

我想了解谷歌如何处理2个单词之间的空格.例如,有2个单词 - word1和word2.我在搜索框'word1word2'中写道,它表示你的意思是'word1 word2'或者只是理解为'word1 word2'.他们使用什么数据结构和算法的任何信息?我在这个答案中看到如何将没有空格的文本拆分成单词列表?,建议使用trie数据结构.

algorithm search nlp

6
推荐指数
2
解决办法
557
查看次数

在Django中与附件异步发送电子邮件

我使用下面的代码发送带有pdf附件的电子邮件.但是,这是一个错误 - "断言没有内容".我不确定为什么会这样.我可以同步发送带有pdf的电子邮件,也可以发送没有pdf的电子邮件异步.(使用Django 1.3)

from django.core.mail import EmailMultiAlternatives
import threading
from django.core.mail import send_mail

class EmailThread(threading.Thread):
    def __init__(self, subject, body, from_email, recipient_list, fail_silently, html,pdf):
        self.subject = subject
        self.body = body
        self.recipient_list = recipient_list
        self.from_email = from_email
        self.fail_silently = fail_silently
        self.html = html
        self.pdf = pdf
        threading.Thread.__init__(self)

    def run(self):
        msg = EmailMultiAlternatives(self.subject, self.body, self.from_email, self.recipient_list)
        msg.attach('ticket.pdf',self.pdf,'application/pdf')
        if self.html:
            msg.attach_alternative(self.html, "text/html")
        msg.send(self.fail_silently)


def send_mail(subject, body, from_email, recipient_list, fail_silently=True, html=None,pdf=None, *args, **kwargs):
    EmailThread(subject, body, from_email, recipient_list, fail_silently, html, pdf).start()
Run Code Online (Sandbox Code Playgroud)

email django

5
推荐指数
1
解决办法
1206
查看次数

使用django获取postgresql的"在事务中空闲"

我们使用的是Django 1.3.1和Postgres 9.1

我有一个视图,它只激发多个选择以从数据库中获取数据.

在Django文档中提到,当请求完成时,如果在调用视图期间仅触发了select语句,则发出ROLLBACK.但是,我在日志中看到很多"闲置在事务中",特别是当我有超过200个请求时.我没有在postgres日志中看到任何提交或回滚语句.

可能是什么问题呢?我该如何处理这个问题?

django postgresql

4
推荐指数
1
解决办法
3284
查看次数

如何在Django中查询floatfield?

我有一个FloatField,其值可以是22.33405,33.567等.现在,我需要在小数点后使用最多2个位置进行查询,如下所示

#find all objects with value equal to 22.33
ModelName.objects.filter(field = 22.33)
Run Code Online (Sandbox Code Playgroud)

是否有可能这样做 - 我可以四舍五入或只取小数后的前2位吗?

谢谢

django django-models

3
推荐指数
1
解决办法
979
查看次数

标签 统计

django ×3

algorithm ×1

django-models ×1

email ×1

gunicorn ×1

nlp ×1

postgresql ×1

search ×1