【发布时间】:2010-02-19 14:37:33
【问题描述】:
我想使用 FastCGI 在 lighttpd 上部署我的 Django 应用程序(使用 postgresql 作为数据库)。
对于 postgresql,我看到 Django 有 2 个可用的后端“postgresql_psycopg2”和“postgresql”。
我的问题是 lighttpd 是一个线程服务器,这些后端有什么问题吗?它们是线程安全的吗?其中哪一个更好/推荐?
我的问题来了,因为我读到一些东西(现在不记得在哪里)postgresql 的python 驱动程序不是线程安全的。
LE:经过更多阅读后,我发现线程问题仅在运行 manage.py method=threaded 时出现,而不是在运行 manage.py method=prefork 时出现,因为这是 FastCGI 进程绑定而不是 Web 服务器绑定(即:无论网络服务器如何,线程或基于进程,但只有 fastcgi 服务器如何运行)
无论如何,在这种情况下,它是线程还是 prefosk 似乎并不重要,因为 Milen A. Radev 回答 postgresql_psycopg2 是线程安全的。
【问题讨论】:
标签: python django postgresql thread-safety lighttpd