On 1 June 2010 15:21, Jason Caldwell <[email protected]> wrote: > Thanks. I installed mod_wsgi and the fcgi.py module... works like a charm!
You don't need fcgi.py for mod_wsgi. The mod_wsgi package is self contained and needs no third party adapters. > trying bobo now -- ran python setup.py install and wrote the simple app: I didn't suggest you use 'bobo'. I suggested you use 'bottle'. This is because as far as I know 'bobo' doesn't work on Python 3.X and the only lightweight framework that I know of that does is 'bottle'. > import bobo > > @bobo.query > def hello(): > return "Hello world!" > > but not working. Then I found your article > (http://blog.dscpl.com.au/2009/08/using-bobo-on-top-of-modwsgi.html) and > added the following line to my hello.py file: > > application = bobo.Application(bobo_resources=__name__) > > however, still not working. Anything else I need to do? Yes, install and configure mod_wsgi properly. At the moment you seem to be configuring for mod_fcgid which is a totally different module. Suggest you start by reading pages linked in: http://code.google.com/p/modwsgi/wiki/InstallationInstructions Get a standard WSGI hello world program running and then try other frameworks. > ### > > My Apache2 settings are as follows: >>>> /etc/apache2/mods-enabled/fcgid.conf > > <IfModule mod_fcgid.c> > SharememPath /tmp/fcgid/fcgid_shm > SocketPath /tmp/fcgid/fcgid.sock > AddHandler fcgid-script .fcgi > IPCConnectTimeout 20 > </IfModule> > >>>> /etc/apache2/sites-enabled/000-default > > <Directory /var/www/cgi-bin> > SetHandler fcgid-script > Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch > Order allow,deny > Allow from all > </Directory> > > ... > ... > >>>> /var/www/cgi-bin/hello.py > > #!/usr/bin/python > > import bobo > > @bobo.query > def hello(): > return "Hello World!" > > application = bobo.Application(bobo_resources=__name__) > > > Thanks, > Jason > > PS. WSGI is lighting fast... totally shocked at the performance I'm getting > out of it. I don't know how you can say that as the above suggests you haven't set up either mod_wsgi or mod_fcgid properly and so nothing is working. Graham > > > > > > > > On May 31, 2010, at 4:55 PM, Graham Dumpleton wrote: > >> Note, have cc'd this back to mod_wsgi list. If possible post followups >> there. See: >> >> http://groups.google.com/group/modwsgi >> >> On 1 June 2010 05:13, Jason Caldwell <[email protected]> wrote: >>> Hi Graham -- >>> >>> As mentioned in a previous email --> love mod_python. However, as you >>> mentioned --> it's going away. >>> >>> So now I'm investigating your mod_wsgi module. The read-up sounds cool, >>> however my dilemma is two-fold: >>> >>> 1. I use Python 3 (for my CGI scripts -- works fantastic, but slow.) I >>> want to keep using Python 3.1.2, which segways into my second dilemma; >> >> Based on discussions I have seen I am dubious CGI will work completely >> on Python 3 as various of the Python standard library modules are >> broken for bytes/unicode as used in CGI. It may be the case that you >> aren't encountering these problems however. At the moment the >> suggestions is that this propagates into WSGI as well. This is in part >> why WSGI on Python 3 is still a bit of an unknown. >> >>> 2. I hate frameworks. They confuse me. Python's CGI functionality is >>> absolutely perfect without an annoying layer (sudo-language) above/between >>> it. >>> >>> So, my question is: >>> Can I use mod_wsgi without the lame frameworks (CherryPy, Django, and so >>> on)? >> >> Yes. The WSGI interface isn't that much different to CGI in >> capabilities. Instead of using os.environ you just use environ >> dictionary passed to application. You also need to ensure you clean up >> per request state and don't leave it around. If your code isn't >> multithread safe, you also need to ensure you use a configuration >> whereby single threaded process is used. >> >> What I suggest you do is read up about what the WSGI interface is and >> experiment with implementing directly on top of it. See: >> >> http://www.python.org/dev/peps/pep-0333/ >> http://code.google.com/p/modwsgi/wiki/SupportForPython3X >> http://www.wsgi.org/wsgi/Learn_WSGI >> >>> If not, is there a very *lightweight* version that works with Py3.1.2 that >>> you know of? Or does mod_wsgi provide it's own embedded framework which I >>> can use? >> >> The only lightweight framework that I know of that advertises itself >> as working with Python, including on top of mod_wsgi is bottle. See: >> >> http://bottle.paws.de/ >> http://bottle.paws.de/page/docs#apache-mod_wsgi >> >>> Recommendation/Suggestion: >>> I'm a seasoned PHP and Coldfusion programmer. Any chance you can can make >>> a mod_python2 and mod_python3 that allows Python to just be Python -- that >>> is; behave just like CGI but embedded? Similar idea to mod_php -- it just >>> works, no frameworks necessary. >> >> You really should just use WSGI. As I said, at the basic interface it >> isn't that much different. >> >> Graham > > -- You received this message because you are subscribed to the Google Groups "modwsgi" 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/modwsgi?hl=en.
