mod-wsgi

Unescape Python Strings From HTTP

六月ゝ 毕业季﹏ 提交于 2019-11-27 02:04:12
I've got a string from an HTTP header, but it's been escaped.. what function can I use to unescape it? myemail%40gmail.com -> myemail@gmail.com Would urllib.unquote() be the way to go? I am pretty sure that urllib's unquote is the common way of doing this. >>> import urllib >>> urllib.unquote("myemail%40gmail.com") 'myemail@gmail.com' There's also unquote_plus : Like unquote(), but also replaces plus signs by spaces, as required for unquoting HTML form values. Yes, it appears that urllib.unquote() accomplishes that task. (I tested it against your example on codepad .) Antti Haapala In Python 3

Debugging Apache/Django/WSGI Bad Request (400) Error

允我心安 提交于 2019-11-27 00:25:37
问题 My simple Django app worked fine in debug mode ( manage.py runserver ), and works under WSGI+Apache on my dev box, but when I pushed to EC2 I began receiving intermittent (10-80% of the time) errors of Bad Request (400) for any URLs I try to view (whether in my app or in the Django admin. Where can I find debug information about this? Nothing appears in /var/log/apache2/error.log , even with LogLevel=info . I have checked versions, logged the Request environment (cf. ModWSGI Debugging Tips)

How to install python developer package?

我的未来我决定 提交于 2019-11-27 00:17:23
问题 I am trying to get mod_wsgi 3.3 to work. When I run make it is telling me that I am missing the Python developer package. How do I get and install the Python developer package? The error I get is as follows: mod_wsgi.c:135:20: error: Python.h: No such file or directory mod_wsgi.c:138:2: error: #error Sorry, Python developer package does not appear to be installed. mod_wsgi.c:142:2: error: #error Sorry, mod_wsgi requires at least Python 2.3.0 for Python 2.X. mod_wsgi.c:150:2: error: #error

Django persistent database connection

好久不见. 提交于 2019-11-26 23:23:13
I'm using django with apache and mod_wsgi and PostgreSQL (all on same host), and I need to handle a lot of simple dynamic page requests (hundreds per second). I faced with problem that the bottleneck is that a django don't have persistent database connection and reconnects on each requests (that takes near 5ms). While doing a benchmark I got that with persistent connection I can handle near 500 r/s while without I get only 50 r/s. Anyone have any advice? How to modify django to use persistent connection? Or speed up connection from python to DB Thanks in advance. Cesar Canassa Django 1.6 has

Target WSGI script cannot be loaded as Python module

半世苍凉 提交于 2019-11-26 21:58:59
I am trying to deploy mod_wsgi with apache to run a django application but I am getting an error 500 internal server error The apache logs shows: [Thu Jun 23 14:01:47 2011] [error] [client 152.78.95.64] mod_wsgi (pid=16142): Exception occurred processing WSGI script '/home/user/bms/apache/django.wsgi'. [Thu Jun 23 14:01:47 2011] [error] [client 152.78.95.64] Traceback (most recent call last): [Thu Jun 23 14:01:47 2011] [error] [client 152.78.95.64] File "/home/user/bms/apache/django.wsgi", line 13, in <module> [Thu Jun 23 14:01:47 2011] [error] [client 152.78.95.64] import django.core.handlers

Popen does not work anymore with apache/wsgi and python 2.7.2?

半腔热情 提交于 2019-11-26 21:49:07
问题 My django application that used to make some shell commands by using python subprocess.Popen does not work anymore since I upgrade to ubuntu to 11.10 To simplify the problem, I put the faulty code into the wsgi script : import os import sys from subprocess import Popen,PIPE p=Popen(['/usr/bin/id'],stdout=PIPE,stderr=PIPE) comm=p.communicate() print comm,p.returncode os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi

How to install mod_wsgi for apache 2.4 and python 3.4 on windows?

倾然丶 夕夏残阳落幕 提交于 2019-11-26 21:26:26
问题 I had apache 2.4 already installed with xampp.I tried adding mod_wsgi using the steps mentioned here But when I add the line LoadModule wsgi_module modules/mod_wsgi-py34-vc10.so Apache does not start. 回答1: It is better to build mod_wsgi yourself from code rather than use an arbitrary binary off the net. The steps are as follows. Ensure you have a decent Apache installation which includes header files, e.g. Apache 2.4.37 Win64 from Apache Lounge . Preferably installed at location of C:

mod_wsgi and multiple installations of python

牧云@^-^@ 提交于 2019-11-26 21:13:10
问题 This is kind of a continuation of this question, but it has deviated so I started a new one. I'd like to use Python 2.5 instead of OS X's default 2.6. I've set this up for my terminal and whatnot, but whenever apache runs it gives me the following error output: [Thu Jun 23 00:01:42 2011] [warn] Init: Session Cache is not configured [hint: SSLSessionCache] [Thu Jun 23 00:01:42 2011] [warn] mod_wsgi: Compiled for Python/2.5.4. [Thu Jun 23 00:01:42 2011] [warn] mod_wsgi: Runtime using Python/2.6

403 Forbidden error with Django and mod_wsgi

懵懂的女人 提交于 2019-11-26 20:32:00
问题 I created Django project in home directory so it is in home directory. Setup Django Verison : 1.5.1 Python Version : 2.7.5 mod_wsgi Version: 3.4 Home Directory : /home/aettool Contents of /home/aettool/aet/apache/django.wsgi import os import sys os.environ['DJANGO_SETTINGS_MODULE'] = 'aet.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() Contect of httpd.conf WSGIScriptAlias / /home/aettool/aet/apache/django.wsgi <Directory /home/aettool/aet

Django long running asynchronous tasks with threads/processing

人走茶凉 提交于 2019-11-26 19:53:07
问题 Disclaimer : I do know that there are several similar questions on SO. I think I've read most if not all of them, but did not find an answer to my real question (see later). I also do know that using celery or other asynchronous queue systems is the best way to achieve long running tasks - or at least use a cron-managed script. There's also mod_wsgi doc about processes and threads but I'm not sure I got it all correct. The question is: what are the exact risks/issues involved with using the