开发者

How to input HTTP data from a WSGI implementation into Django?

开发者 https://www.devze.com 2023-03-19 06:34 出处:网络
I want to create a Django application that acts as mi开发者_Go百科ddleware between two transparent WSGI implementations which simply pass along data. So far, all I want this application to do is log t

I want to create a Django application that acts as mi开发者_Go百科ddleware between two transparent WSGI implementations which simply pass along data. So far, all I want this application to do is log the HTTP data that it receives into a database for debugging purposes and then passes the information to the next WSGI implementation in line (which then handels this information to a web server like Apache)

My question is, how do I write a Django application that only receives existing HTTP data instead of creating it? I'm guessing this application would have no urls, just a view of some sort, a custom Django middleware component, and the database. So how would I connect a WSGI implementation to the input of a Django app so that Django can read the information, log it, then output it? I know how to do the actual logging and outputting for I'm just confused about the inputting.


There was a GSOC project in the past related to making it easier/possible to plug WSGI middleware into Django. Code at:

https://code.djangoproject.com/browser/django/branches/soc2009/http-wsgi-improvements

I don't know what happened to that.

Alex Gaynor has also played with better WSGI integration:

http://alexgaynor.net/2010/jan/11/hot-django-wsgi-action-announcing-django-wsgi/

If you don't get an answer here then suggest asking on Django users mailing list.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号