#2407: [patch] CGI Support for django
-------------------------------------------------------+--------------------
Reporter: Martin Glueck <[EMAIL PROTECTED]> | Owner:
adrian
Status: new | Component:
Core framework
Version: SVN | Resolution:
Keywords: cgi | Stage:
Design decision needed
Has_patch: 1 | Needs_docs:
0
Needs_tests: 1 | Needs_better_patch:
1
-------------------------------------------------------+--------------------
Comment (by jedie):
* Silly 1: there is no official documentation about how to run django with
CGI :( I known, CGI is not the preferred setup.
* Silly 2: in this ticket are too many files. What way is the best?
I tried http://code.djangoproject.com/attachment/ticket/2407/django.cgi
But it doesn't run, if the URL is empty, example:
* ".../django.cgi" works not
* ".../django.cgi/foo" works.
It's because, the
http://code.djangoproject.com/browser/django/trunk/django/core/handlers/wsgi.py
file access to "PATH_INFO" in the os.environ. But my Apache2 put only this
requested path into the environ if it is not empty.
Here a small patch, for this:
{{{
Index: wsgi.py
===================================================================
--- wsgi.py (revision 4556)
+++ wsgi.py (working copy)
@@ -73,7 +73,7 @@
class WSGIRequest(http.HttpRequest):
def __init__(self, environ):
self.environ = environ
- self.path = environ['PATH_INFO']
+ self.path = environ.get('PATH_INFO','/')
self.META = environ
self.method = environ['REQUEST_METHOD'].upper()
}}}
Also it would work, if we change the
http://code.djangoproject.com/attachment/ticket/2407/django.cgi file and
insert:
{{{
...
def run_with_cgi(application):
environ = dict(os.environ.items())
+ environ['PATH_INFO'] = environ.get('PATH_INFO',"/")
environ['wsgi.input'] = sys.stdin
environ['wsgi.errors'] = sys.stderr
environ['wsgi.version'] = (1,0)
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/2407#comment:9>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---