我试图用mod_wsgi而不是mod_python(RHEL 5)运行我的Django站点.我尝试了所有我的网站,但遇到了同样的问题.我按照每个人推荐的标准方式配置它,但对网站的请求只是超时.
Apache conf:
<VirtualHost 74.54.144.34>
DocumentRoot /wwwclients/thymeandagain
ServerName thymeandagain4corners.com
ServerAlias www.thymeandagain4corners.com
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
CustomLog /var/log/httpd/thymeandagain_access_log combined
ErrorLog /var/log/httpd/thymeandagain_error_log
LogLevel error
WSGIScriptAlias / /wwwclients/thymeandagain/wsgi_handler.py
WSGIDaemonProcess thymeandagain user=admin group=admin processes=1 threads=16
WSGIProcessGroup thymeandagain
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
wsgi_handler.py:
import sys
import os
sys.path.append("/wwwclients")
os.environ['DJANGO_SETTINGS_MODULE'] = 'thymeandagain.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
Run Code Online (Sandbox Code Playgroud)
守护进程mod_wsgi应该产生不存在,所以请求只是超时,我在日志中得到了一堆"无法连接到WSGI守护程序进程"错误.有没有关于WSGIDaemonProcess指令阻止创建守护进程的东西?在此先感谢任何帮助......
编辑:我在错误日志中得到这个:
[WARN@1227228322.174175] mcm_server_readable():2582: timeout: Operation now in progress: select(2) call timed out for read(2)able fds
[INFO@1227228322.174263] mcm_get_line():1592
[WARN@1227227903.249626] mcm_server_readable():2582: timeout: Operation now in …
Run Code Online (Sandbox Code Playgroud) 我有一个django模型如下:
class Subscription(models.Model):
Transaction = models.ManyToManyField(Transaction, blank=True, null=True)
User = models.ForeignKey(User)
...etc...
Run Code Online (Sandbox Code Playgroud)
我正在尝试将ManyToMany字段添加到User模型,如下所示:
SubUsers = models.ManyToManyField(User, blank=True, null=True)
Run Code Online (Sandbox Code Playgroud)
但是当我运行syncdb时出现此错误:
AssertionError: ManyToManyField(<django.db.models.fields.related.ForeignKey object at 0x19ddfd0>) is invalid. First parameter to ManyToManyField must be either a model, a model name, or the string 'self'
Run Code Online (Sandbox Code Playgroud)
如果我用引号引用用户,我会改为:
sales.subscription: 'User' has a relation with model User, which has either not been installed or is abstract.
Run Code Online (Sandbox Code Playgroud)
我知道用户模型已正确导入.有两个字段指向User模型的任何想法会导致问题吗?提前致谢...
我会自动将 HTML 页面的内容翻译成不同的语言,因此我必须从有时写得很糟糕的不同 HTML 页面中提取所有文本节点(我无法编辑这些 HTML)。
通过使用 BeautifulSoup,我可以轻松提取这些文本并将其替换为翻译,但是当我在这些操作后显示 HTML 时: html = BeautifulSoup(source_html) - 它有时会损坏,因为 BeautifulSoup 会自动关闭标签(例如 table 标签在错误的位置关闭) .
有没有办法阻止 BeautifulSoup 关闭这些标签?
例如,这是我的输入:
html = "<table><tr><td>some text</td></table>"
- 关闭 tr 丢失
在汤 = BeautufulSoup(html) 之后我得到 "<table><tr><td>some text</td></tr></table>"
我想获得与输入完全相同的html...
有可能吗?
django ×2
python ×2
apache ×1
foreign-keys ×1
html-parsing ×1
many-to-many ×1
mod-wsgi ×1
parsing ×1
tinymce ×1