- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我一直坚持将我的 Django 项目移动到由 DreamHost 托管的生产 CentOS 服务器。安装了 Apache 2.2.23 和 Python 2.6.6。我已经安装并配置了 Django 1.4 和 mod_wsgi 3.4。当我通过键入
重新启动 Apache(希望 Web 应用程序能够完美运行)时sudo apachectl restart
我在/usr/local/apache/logs/中查看 Apache 的 error_log 并看到:
[Mon Nov 12 18:05:24 2012] [info] Init: Seeding PRNG with 144 bytes of entropy
[Mon Nov 12 18:05:24 2012] [notice] SSL FIPS mode disabled
[Mon Nov 12 18:05:24 2012] [info] Loading certificate & private key of SSL-aware server
[Mon Nov 12 18:05:24 2012] [info] Init: Generating temporary RSA private keys (512/1024 bits)
[Mon Nov 12 18:05:24 2012] [info] Init: Generating temporary DH parameters (512/1024 bits)
[Mon Nov 12 18:05:24 2012] [info] Init: Initializing (virtual) servers for SSL
[Mon Nov 12 18:05:24 2012] [info] Configuring server for SSL protocol
[Mon Nov 12 18:05:24 2012] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Mon Nov 12 18:05:24 2012] [info] mod_ssl/2.2.23 compiled against Server: Apache/2.2.23, Library: OpenSSL/1.0.0-fips
[Mon Nov 12 18:05:24 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/local/apache/bin/suexec)
[Mon Nov 12 18:05:24 2012] [info] Init: Seeding PRNG with 144 bytes of entropy
[Mon Nov 12 18:05:24 2012] [notice] SSL FIPS mode disabled
[Mon Nov 12 18:05:24 2012] [info] Loading certificate & private key of SSL-aware server
[Mon Nov 12 18:05:24 2012] [info] Init: Generating temporary RSA private keys (512/1024 bits)
[Mon Nov 12 18:05:24 2012] [info] Init: Generating temporary DH parameters (512/1024 bits)
[Mon Nov 12 18:05:24 2012] [info] Init: Initializing (virtual) servers for SSL
[Mon Nov 12 18:05:24 2012] [info] Configuring server for SSL protocol
[Mon Nov 12 18:05:24 2012] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Mon Nov 12 18:05:24 2012] [info] mod_ssl/2.2.23 compiled against Server: Apache/2.2.23, Library: OpenSSL/1.0.0-fips
[Mon Nov 12 18:05:24 2012] [info] mod_wsgi (pid=30259): Starting process 'myproject.mysite.net' with uid=99, gid=99 and threads=1.
[Mon Nov 12 18:05:24 2012] [info] mod_wsgi (pid=30259): Initializing Python.
[Mon Nov 12 18:05:24 2012] [info] mod_wsgi (pid=30260): Initializing Python.
[Mon Nov 12 18:05:24 2012] [info] mod_wsgi (pid=30261): Initializing Python.
[Mon Nov 12 18:05:24 2012] [info] mod_wsgi (pid=30262): Initializing Python.
[Mon Nov 12 18:05:24 2012] [info] mod_wsgi (pid=30263): Initializing Python.
[Mon Nov 12 18:05:24 2012] [info] mod_wsgi (pid=30264): Initializing Python.
[Mon Nov 12 18:05:24 2012] [notice] Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_wsgi/3.4 Python/2.6.6 configured -- resuming normal operations
[Mon Nov 12 18:05:24 2012] [info] Server built: Oct 21 2012 05:57:19
[Mon Nov 12 18:05:24 2012] [info] mod_wsgi (pid=30259): Attach interpreter ''.
[Mon Nov 12 18:05:24 2012] [info] mod_wsgi (pid=30260): Attach interpreter ''.
[Mon Nov 12 18:05:24 2012] [info] mod_wsgi (pid=30262): Attach interpreter ''.
[Mon Nov 12 18:05:24 2012] [info] mod_wsgi (pid=30261): Attach interpreter ''.
[Mon Nov 12 18:05:24 2012] [info] mod_wsgi (pid=30263): Attach interpreter ''.
[Mon Nov 12 18:05:24 2012] [info] mod_wsgi (pid=30264): Attach interpreter ''.
[Mon Nov 12 18:05:28 2012] [info] mod_wsgi (pid=30270): Initializing Python.
[Mon Nov 12 18:05:28 2012] [info] mod_wsgi (pid=30270): Attach interpreter ''.
[Mon Nov 12 18:07:50 2012] [info] mod_wsgi (pid=30311): Initializing Python.
[Mon Nov 12 18:07:50 2012] [info] mod_wsgi (pid=30311): Attach interpreter ''.
[Mon Nov 12 18:07:51 2012] [info] [client 24.143.104.168] (32)Broken pipe: core_output_filter: writing data to the network
[Mon Nov 12 18:10:44 2012] [info] [client 180.76.5.64] (104)Connection reset by peer: core_output_filter: writing data to the network
[Mon Nov 12 18:11:26 2012] [info] mod_wsgi (pid=30356): Initializing Python.
[Mon Nov 12 18:11:26 2012] [info] mod_wsgi (pid=30356): Attach interpreter ''.
我觉得这可能与 Python 路径有关。只是一个猜测。看起来 Python 一直在崩溃。
/home
/myproject
/public_html (server document root)
/django_proj
/myproject (django project root)
settings.py
other files and app directories for this django project
/apache
wsgi.py
django.wsgi
这是 httpd.conf 的相关部分:
<VirtualHost *:80>
ServerName myproject.mysite.net
ServerAdmin myemail@abc.com
DocumentRoot /home/myproject/django_proj/myproject
<Directory /home/myproject/django_proj/myproject>
AllowOverride All
Order allow,deny
Allow from all
</Directory>
WSGIDaemonProcess myproject.mysite.net processes=1 threads=1 display-name=%{GROUP}
WSGIProcessGroup myproject.mysite.net
WSGIApplicationGroup %{GLOBAL}
WSGIScriptAlias / /home/myproject/django_proj/myproject/apache/django.wsgi
<Directory /home/myproject/django_proj/myproject/apache>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
这是我的 wsgi.py:
import os
path = '/home/myproject/django_proj'
if path not in sys.path:
sys.path.append(path)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings")
# This application object is used by the development server
# as well as any WSGI server configured to use this file.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
这是我的 django.wsgi:
def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
我还尝试将其托管为 URL“myproject.mysite.net”,而不仅仅是“mysite.net”。也不确定我这样做是否正确。
最佳答案
实际问题是什么?您在发出请求时是否真的遇到了错误。
日志输出看起来完全正常。所有单独的进程都是因为 Python 也在 Apache 子工作进程中被初始化。设置:
WSGIRestrictEmbedded On
他们会离开,应该只看到一个过程。
有关该指令的说明,请参阅:
http://blog.dscpl.com.au/2009/11/save-on-memory-with-modwsgi-30.html
顺便说一句,使用“processes=1 threads=1”似乎是一个糟糕的选择。一次只能处理一个请求。
关于django - 无法使用 Apache 和 mod_wsgi 使简单的 Django Web 应用程序正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13354453/
大中型 python WSGI 应用,Apache + mod_wsgi 还是 Nginx + mod_wsgi 用什么? 哪种组合需要更多的内存和 CPU 时间? 哪个更快? 哪个以比另一个更稳定而
我通过 python CGI 脚本 (Apache2.4) 继承了在 AWS EC2 Windows 实例和 WAMP 服务器上运行的 Web 应用程序。我希望将 Web 应用程序转换为 Flask,
当我输入: [root@lts5 /]# ldd /usr/lib64/httpd/modules/mod_wsgi.so libpython2.5.so.1.0 => /root/epd-5
我正在尝试在 Ubuntu 16.04.6 服务器上部署带有 Apache2 和 mod_wsgi 的 Django 应用程序,但我正在努力让 mod_wsgi 使用正确的 python 版本。 我从
介绍 我有一个用 python 3 编写的 Web API,它使用 flask 。当我从终端运行 Web API 时,代码运行良好,它托管在代码的以下行中。 if __name__ == '__mai
我的 Django 项目中的 MemoryError 有一个奇怪的问题。 Ubuntu 11 Apache 2 Nginx mod_wsgi python2.7 我有一个使用 PIL 调整图像大小的模
在这里撕扯我的头发试图弄清楚为什么我的两个 Django 项目没有被分开提供......似乎首先访问的静态文件成为两个项目的事实上的静态文件,或者类似的东西。 我试图通过同一个 IP 地址的两个域名为
我正在通过发出一个需要 30 多分钟才能完成的请求来测试在 Apache Web 服务器上运行的 Python Flask Web 应用程序的限制。该请求需要向 MySQL 数据库发送数千个数据库请求
有谁知道如何制作mod_wsgi当任何模块更改时自动重新加载 Flask 应用程序?我试过WSGIScriptReloading On ,但没有运气。 official documentation有点
使用 mod_wsgi 部署应用程序时出现以下错误 [Thu Apr 07 11:23:32 2011] [error] [client localhost] IOError: [Errno 13]
我有用 Django 开发的普通内容管理网站。我的客户有一个具有 256 MB RAM 的服务器。他想以 wsgi 模式部署此站点。 256 MB RAM 是否足够?我对服务器 RAM 要求等一无所知
我对 Python 和 Python Web 应用程序开发比较陌生。目前我正在使用 mod_wsgi 在 Python 中创建一个 hello world 应用程序 这是我的配置。 Apache 配置
我有一个 wsgi 应用程序作为 mod_wsgi 守护进程(在守护进程模式下)运行。我的设置是每个守护进程在 1000 个请求后重新启动,如 mod_wsgi 配置指南中所示: http://cod
我在centos系统上安装了Postgres、mod_wsgi和python3.5。我已经测试了连接,它在交互式 Python shell 和开发应用程序中都运行良好(它是一个 Pyramid 应用程
我在 Centos 6 服务器上使用 Python Flask,mod_wsgi 突然不能工作了。 这是错误信息。 mod_wsgi (pid=6206): Target WSGI script '/
我一直在研究在运行 Python/mod_wsgi 的网络场中创建快速缓存的不同系统。 Memcache 和其他是选项......但我想知道: 因为我不需要跨机器共享数据,希望每台机器都维护一个本地缓
我在 apache2 上运行 mod_wsgi。它正在运行 Django,出于某种原因,在我更改代码后,旧版本有时会与新代码一起显示。 例如,在创建一个仅返回带“Hi”的 Http 响应的 View
当我尝试安装 mod_wsgi 时遇到以下错误 ./configure checking for apxs2... no checking for apxs... /usr/sbin/apxs che
我正在使用 Hostgator 开发 Linux Centos 虚拟主机。我使用的是 httpd 版本 2.2.15。 我使用标签 --with-python=/usr/local/bin/pytho
我使用 CherryPy、Apache 和 mod_wsgi 构建了一个网站,除了一个问题之外,一切都很好。当用户操作要求自动发送电子邮件时,我有时会使用 os.fork ,以便父进程可以立即返回并向
我是一名优秀的程序员,十分优秀!