wsgi

WSGI Authentication: Homegrown, Authkit, OpenID...?

I want basic authentication for a very minimal site, all I personally need is a single superuser. While hard-coding a password and username in one of my source files is awfully tempting, especially since I'm hosting the site on my own server, I feel I'm breaking the law of the internets and I should just use a database (I'm using sqlite ...

Python - Overridding print()

I'm using mod_wsgi and was wondering if it's possible to over-write the print() command (since it's useless). Doing this doesn't work: print = myPrintFunction Since it's a syntax error. :( ...

How to catch POST using WSGIREF

I am trying to catch POST data from a simple form. This is the first time I am playing around with WSGIREF and I can't seem to find the correct way to do this. This is the form: <form action="test" method="POST"> <input type="text" name="name"> <input type="submit"></form> And the function that is obviously missing the right informat...

Pylons or TurboGears vs. .NET or Java

We're embarking on a project for a client. They plan on having about 50k users by the end of the year. We're pushing to use Pylons w/ Mako and SQLAlchemy, and our contact there is excited about it, but some of his colleagues are wary because it's not .NET or J2ee (they're used to enterprisey stuff). Their web app will have some data an...

What is a good way to handle cookies in Pylons?

I've seen a few references that say there is WSGI middleware to do it, but I don't know a lot about the choices for WSGI middelware that handles cookies. ...

FastCgi crashes -- Want to catch all exceptions but how?

Hi, I have a django app running on apache with fastcgi (uses Flup's WSGIServer). This gets setup via dispatch.fcgi, concatenated below: #!/usr/bin/python import sys, os sys.path.insert(0, os.path.realpath('/usr/local/django_src/django')) PROJECT_PATH=os.environ['PROJECT_PATH'] sys.path.insert(0, PROJECT_PATH) os.chdir(PROJECT_PAT...

mod_wsgi 2.5 on Ubuntu 9.04 with Python 2.6.2 installation.

Has anybody succeeded with mod_wsgi 2.5 on Ubuntu 9.04 with default Python installation (2.6.2)? I got compilation errors: mod_wsgi.c:119:2: error: #error Sorry, mod_wsgi requires at least Python 2.3.0. mod_wsgi.c:123:2: error: #error Sorry, mod_wsgi requires that Python supporting thread. which Python gives /usr/bin/python and /usr/...

Passing data to mod_wsgi

In mod_wsgi I send the headers by running the function start_response(), but all the page content is passed by yield/return. Is there a way to pass the page content in a similar fashion as start_response()? Using the return.yield statement is very restrictive when it comes to working with chunked data. E.g. def Application(): b = ...

Image distortion after sending through a WSGI app in Python

A lot of the time when I send image data over WSGI (using wsgiref), the image comes out distorted. As an example, examine the following: ...

Loose coupling in a WSGI application/toolkit (templating specifically)

Hallo, I looked at the various loose-coupling questions around here but couldn't pin down something similar to my question, so apologies if it's already been asked. Basically I have a homegrown, very simplistic routing library that consists of Segments, Hubs, and Stubs. Hubs and Stubs inherit Segments, and represent directories or primi...

Creating dynamic images with WSGI, no files involved

Hello there fellow SOers, I would like to send dynamically created images to my users, such as charts, graphs etc. These images are "throw-away" images, they will be only sent to one user and then destroyed, hence the "no files involved". I would like to send the image directly to the user, without saving it on the file system first. W...

How to construct a webob.Request or a WSGI 'environ' dict from raw HTTP request byte stream?

Suppose I have a byte stream with the following in it: POST /mum/ble?q=huh Content-Length: 18 Content-Type: application/json; charset="utf-8" Host: localhost:80 ["do", "re", "mi"] Is there a way to produce an WSGI-style 'environ' dict from it? Hopefully, I've overlooked an easy answer, and it is as easy to achieve as the opposite o...

webdav for wsgi/python?

Hi folks. I want to add WebDAV to whiff. This would be easy if I could find a simple WSGI component that implements WebDAV. I found http://pyfilesync.berlios.de/pyfileserver.html, but it seems to insist on using an external configuration file. I want to control everything via a Python API. Any ideas? Thanks! ...

Deploying a Web.py application with WSGI, several servers

I've created a web.py application, and now that it is ready to be deployed, I want to run in not on web.py's built-in webserver. I want to be able to run it on different webservers, Apache or IIS, without having to change my application code. This is where WSGI is supposed to come in, if I understand it correctly. However, I don't unders...

Upload a potentially huge textfile to a plain WSGI-server in Python

I need to upload a potentially huge plain-text file to a very simple wsgi-app without eating up all available memory on the server. How do I accomplish that? I want to use standard python modules and avoid third-party modules if possible. ...

Profiling Python Scripts running on Mod_wsgi

How can I profile a python script running on mod_wsgi on apache I would like to use cProfile but it seems it requires me to invoke a function manually. Is there a way to enable cProfile globally and have it keep on logging results. ...

admin/appname/modelname urls does not work with mod_wsgi in Django 1.1rc1

I'm using Django 1.1 rc1 and Apache 2.2.8 on Ubuntu with mod_wsgi 1.3.1 + Python 2.5.2. Everything worked fine with Django's internal testing web server, but after migrating to Apache mod_wsgi, all urls like /admin/appname/modelname/ began not to work. They shows 404 not found errors with the following log: ... ^admin/ ^$ ^admin/ ^logo...

How can I tell whether my Django application is running on development server or not?

How can I be certain that my application is running on development server or not? I suppose I could check value of settings.DEBUG and assume if DEBUG is True then it's running on development server, but I'd prefer to know for sure than relying on convention. ...

Replace AppEngine Devserver With Spawning (BaseHTTPRequestHandler as WSGI)

I'm looking to replace AppEngine's devserver with spawning. Spawning handles standard wsgi handlers, just like appengine, so running your app on it is easy. But the devserver takes into account your app.yaml file that has url redirects etc. I've been going through the devserver code and it is pretty easy to get the BaseHTTPRequestHandle...

Looking for a diagram to explain WSGI

To help further my understanding of WSGI I'm looking for a diagram which explains the flow of an application, from webserver (eg. apache) through a number of middlewares to "code" (as in, the print "hello world" bit). I've read various articles regarding WSGI from wsgi.org, but it's still not "clicking" for me and as for diagrams Googl...