我按照教程在Apache上安装了一个Djando应用程序。 Django项目是在/ opt目录下创build的。 任何build议或其他教程,我可以使用? 我浏览Django网站上的一些教程并没有成功。 该应用程序不提供任何静态页面,只是接收请求。 但是,我们确实设置了一个testing文件来检查应用程序是否在urls.py中工作。 我得到一个404错误。 错误: 服务暂时不可用 由于维护停机或>容量问题,服务器暂时无法处理您的请求。 请稍后再试。 这里是当前configuration设置:app.wsgi import os, sys sys.path.append('/opt/<APPLICATION>') sys.path.append('<PATH TO PYTHON INSTALL>/django') os.environ['DJANGO_SETTINGS_MODULE'] = '<APPLICATION>.settings_production' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() 操作系统:CentOS Python:2.7 框架:Django MOD:MOD_WSGI WebServer:Apache Apache条目: LoadModule wsgi_module modules/mod_wsgi.so AddHandler wsgi-script .wsgi WSGIDaemonProcess server threads=25 display-name=%{GROUP} WSGIProcessGroup server WSGIScriptAlias / /opt/<APPLICATION>/<APPLICATION>.wsgi <Directory /opt/<APPLICATION>> Order allow,deny Allow […]
我正在根据这些说明设置CKAN,一个挂架应用程序: http ://packages.python.org/ckan/deployment.html 但是,当我指向服务器(没有DNS设置),使用IP或主机名,我只看到Apache的问候页面,sugesting ckan应用程序没有被加载。 这里是我的mod_wsgi脚本: import os instance_dir = '/home/flavio/var/srvc/ckan.emap.fgv.br' config_file = 'ckan.emap.fgv.br.ini' pyenv_bin_dir = os.path.join(instance_dir, 'pyenv', 'bin') activate_this = os.path.join(pyenv_bin_dir, 'activate_this.py') execfile(activate_this, dict(__file__=activate_this)) from paste.deploy import loadapp config_filepath = os.path.join(instance_dir, config_file) from paste.script.util.logging_config import fileConfig fileConfig(config_filepath) application = loadapp('config:%s' % config_filepath) 这里是我的虚拟主机configuration: <VirtualHost *:80> ServerName dck093 ServerAlias dck093 WSGIScriptAlias / /home/flavio/var/srvc/ckan.emap.fgv.br/pyenv/bin/ckan.emap.fgv.br.py # pass […]
我正在使用Python 2.7与mod_python 3.3.1和mod_wsgi 3.3。 我得到一个内部服务器错误和Apache日志中的这个堆栈跟踪: [Thu Apr 21 10:25:37 2011] [error] [client 83.244.243.242] import django.core.handlers.wsgi [Thu Apr 21 10:25:37 2011] [error] [client 83.244.243.242] ImportError: No module named django.core.handlers.wsgi [Thu Apr 21 10:25:37 2011] [error] [client 83.244.243.242] mod_wsgi (pid=4463): Target WSGI script '/home/one/codebase/campman/wsgi_handler.py' cannot be loaded as Python module. [Thu Apr 21 10:25:37 2011] [error] [client […]
我试图在RedHat Linux上安装mod_wsgi。 我得到这个错误: apxs:Error: Command failed with rc=65536 答案似乎在这里 ,但我认为我已经有64位的Python,所以我不清楚在这种情况下我应该做什么。 安装命令: [django – ping@e02u35]~/mod_wsgi-3.3>./configure –with-python=/usr/local/python-2.7.1/bin/python checking for apxs2… no checking for apxs… /usr/sbin/apxs checking Apache version… 2.2.3 configure: creating ./config.status config.status: creating Makefile [django – ping@e02u35]~/mod_wsgi-3.3>make /usr/sbin/apxs -c -I/usr/local/python-2.7.1/include/python2.7 -DNDEBUG mod_wsgi.c -L/usr/local/python-2.7.1/lib -L/usr/local/python-2.7.1/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm /usr/lib64/apr-1/build/libtool –silent –mode=compile gcc -prefer-pic -O2 -g […]
我一直在试图教自己创build和部署Django应用程序。 我创build了一个testing项目,我可以使用Djangotesting服务器浏览它。 现在我想用apache和mod_wsgi来部署它。 我按照“ 快速安装指南”中的安装说明安装了mod_wsgi。 然后,我查看了“ 快速configuration指南”中的示例,并能够成功连接到浏览器中的示例输出。 我现在已经转向与Django集成( http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango )部分,我无法取得任何进展。 任何时候,我尝试浏览到我为我的项目设置的URL,而是使用configuration指南创build的示例输出。 我已经看了Apache的错误日志,并没有消息(当我debugging第一个例子时,我得到了一些,所以我知道我正在查看正确的日志)。 我甚至设置了“LogLevel info”来尝试获取日志中的更多细节,但是没有。 有没有人有什么build议? 这里是我的apach2.conf: LockFile ${APACHE_LOCK_DIR}/accept.lock PidFile ${APACHE_PID_FILE} Timeout 300 KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 15 <IfModule mpm_prefork_module> StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxClients 150 MaxRequestsPerChild 0 </IfModule> <IfModule mpm_worker_module> StartServers 2 MinSpareThreads 25 MaxSpareThreads 75 ThreadLimit 64 ThreadsPerChild 25 MaxClients 150 […]
我试图让mod_wsgi工作om我的CentOs服务器,所以我可以在Apache上运行Django网站。 我已经安装了python2.7 paralel 2.4(因为你必须保持2.4以保持百胜高兴),根用户使用2.7。 我想要做: # wget http://modwsgi.googlecode.com/files/mod_wsgi-3.3.tar.gz # tar -zxvf mod_wsgi-3.3.tar.gz # cd mod_wsgi-3.3 # ./configure –help # ./configure –with-python=/usr/local/python27/bin/python # make # make_install 但失败; 它给了我一个巨大的错误,我会在下面发表。 我一直在search,发现我可能错过了一个python2.7-dev或python2.7-devel包,类似的,也是因为错误的第一行报告缺less.h文件。 但是我无法在centos上find2.7的开发包。 所以我希望有人能给我一个提示,TNX。 这是错误, 我在中间删除了很多! 提前致谢! [root@ve mod_wsgi-3.3]# make /usr/sbin/apxs -c mod_wsgi.c -Wl,-F -framework /usr/lib64/apr-1/build/libtool –silent –mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector –param=ssp-buffer-size=4 -m64 […]
你好,我不得不今天重新安装mod_wsgi(因为我们的红帽服务器再次被扼杀)。 用Django进行部署时有趣的事情发生了。 我一直在获取页面403错误You do not have permission to access /mmc on this server错误。 我的项目文件夹存储在/usr/local/src/djcode/c2duo_mms' The permission of my project folder and all of its contents are set to chmod 755`。 应用程序名称叫做mmc。 django.wsgi file import os import sys sys.path.append('/usr/local/src/djcode/') sys.path.append('/usr/local/src/djcode/c2duo_mms') os.environ['DJANGO_SETTINGS_MODULE'] = 'c2duo_mms.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandle() httpd.conf file WSGIScriptAlias /mmc /usr/local/src/djcode/c2duo_mms/apache/django.wsgi WSGIPythonEggs /tmp <Directory […]
我正在尝试在我的VPS runninr Centors 5.21上安装mod_wsgi.so。 我安装了python 2.6并编译了mod_wsgi。 这一切都应该与错误。 当我在Apache中包括mod_wsgi.so我得到的错误: mod_wsgi.so: undefined symbol: ap_close_listeners — 我search谷歌没有运气。 有任何想法吗? TNX。
很长的故事 TL;博士: 在Apache下面的configuration与Python解释器上下文混淆。 我有三个使用此设置部署的演示站点,如果经常刷新它们,则会出现竞争情况,并且来自数据库的某些文本/图像会相互混淆。 vhost conf: <VirtualHost *:80> ServerName demo.motion-m.ca ServerAlias *.demo.motion-m.ca Options FollowSymLinks UseCanonicalName Off VirtualDocumentRoot /var/www/vhosts/%0 RewriteEngine On RewriteMap lowercase int:tolower LogFormat "%{Host}i %h %u %t \"%r\" %s %b" vcommon CustomLog /var/log/apache2/demo.motion-m.ca vcommon # Handle everything except the static/media RewriteCond %{REQUEST_URI} !^/(media|static)/(.*)$ RewriteRule ^/(.*) /var/www/vhosts/%{HTTP_HOST}/apache/django.wsgi/$1 RewriteRule . – [E=APPLICATION_GROUP:${tolower:%{SERVER_NAME}}] # Use the subdomain […]
在RHEL 5服务器上工作。 尝试制作一个小型的CherryPy应用程序,它从url中获取参数(例如,internet.com/cherrypy/data/22/45将返回22和45),然后使用它们来查询包含这些参数的SQL Server。 然后以JSON格式返回。 困在一个相当大的路障。 RHEL 5附带了Python 2.4,2.4没有原生的JSON处理,所以我从EPEL和2.4一起安装了Python26。 我可以用python26命令运行2.6,也可以用普通的python命令运行2.4。 我读了2.4,因为我已经阅读yum取决于2.4。 然后,我从2.4中删除CherryPy,并重新安装了2.6。 我使用Mod_wsgi在Apache2下运行CherryPy。 所以我推测这可能是问题的根源。 我想如果我加了一个shebang(刚刚了解到这个,很好的名字,呵呵)给我的CherryPy脚本,它会用2.6来解释它,但是它没有,而且当我去到CherryPy应用程序(internet.com/cherrpy/)。 这是我目前的脚本: #!/usr/bin/python2.6 import sys sys.stdout = sys.stderr import atexit import threading import cherrypy cherrypy.config.update({'environment': 'embedded'}) class Root(object): def index(self): return 'Nothing to see here. Move along.' index.exposed = True def data(self, building, ser): return 'You requested data for SER number: […]