[00:13] *** vmlemon_ has joined #kamaelia |
[07:07] *** bcarlyon|laptop has joined #kamaelia |
[08:13] *** Uraeus has joined #kamaelia |
[09:16] *** vmlemon_ has joined #kamaelia |
[09:31] *** vmlemon_ has joined #kamaelia |
[09:33] < vmlemon_> Hi |
[09:33] < vmlemon_> kamlogbot: dance |
[09:33] Reply: does the macarena |
[09:51] *** Uraeus has joined #kamaelia |
[09:55] *** Davbo has joined #kamaelia |
[10:11] *** vmlemon__ has joined #kamaelia |
[10:22] < Davbo> afternoon all |
[10:24] < vmlemon__> Hi Davbo |
[10:24] *** vmlemon__ is now known as vmlemon_ |
[10:32] *** vmlemon_ has joined #kamaelia |
[11:21] *** Chong- has joined #kamaelia |
[11:52] *** Davbo is lost in WSGI Code |
[11:52] < Davbo> j_baker: can you just show me how to run an example app please :-) |
[12:04] *** orphans has joined #kamaelia |
[12:55] *** Davbo has joined #kamaelia |
[13:48] *** Davbo has joined #kamaelia |
[13:49] < j_baker> Davbo, I'm writing up a post to help clarify the WSGI code some for you. |
[13:50] < j_baker> Which part are you getting lost at? |
[13:51] < Davbo> Just got back in, give me a second j_baker :) |
[13:52] < Davbo> Shouldn't your example wsgi app's have mains btw? So you could easily run them? |
[13:52] < Davbo> or, how do I run them :) |
[13:53] < j_baker> Well, first of all, are you running Kamaelia WebServe or are you using a web server like in the example? |
[13:54] < j_baker> To answer your question, a WSGI "application" is really just a function, albeit one that is expected to perform certain ways. |
[13:55] < Davbo> I thought so |
[13:55] < Davbo> I'd expect your examples to have mains which run the Kamaelia WebServe and the app within that though |
[13:57] < j_baker> Kamaelia WebServe isn't really anything more than a version of those examples that does more fancy stuff. :) |
[13:57] < j_baker> The real meat of the WSGI code is in the WSGI Factories and the WSGI Handler. |
[13:58] < Davbo> I've been looking at Handler this morning |
[13:58] < j_baker> Yeah, that does the actual grunt work of running the WSGI application |
[13:59] < j_baker> SimpleWSGIFactory and WSGIFactory do the part of figuring out which WSGI application to run. |
[14:00] < j_baker> (admittedly, WSGIFactory is somewhat uglier than SimpleWSGIFactory partly because of some optimizations that I've made) |
[14:00] < Davbo> I mean, it would help if I were familiar with the standards of WSGI (it would help *alot*) so I really just want to get one of your apps running as that's makes up a lot of testing I can do |
[14:00] < j_baker> Ok, I'll post that to the board. |
[14:01] < j_baker> I just now realized that I didn't actually give you a sample application to run with PasteApp either. |
[14:02] < Davbo> Yeah, PasteApp is an interpreter for those PythonPaste app's? |
[14:02] < Davbo> is what I gathered from it anyway |
[14:02] < j_baker> No, Paste Deploy is a WSGI App that serves to find other WSGI Apps |
[14:03] < j_baker> A lot of people use it because it has more advanced URL routing stuff than most WSGI servers. |
[14:03] < Davbo> ah i see |
[14:03] < j_baker> Actually, I'll tell you what will be the easiest way to get started: move on to Kamaelia WebServer first. |
[14:04] < j_baker> I can walk you through getting that set up if you want. |
[14:04] < Davbo> Alright, 1 moment |
[14:06] < Davbo> Sorry, was sorting some stuff. |
[14:07] < j_baker> np |
[14:07] < j_baker> First of all, you'll want to go to private_JMB_Wsgi/Apps/Kamaelia-WebServe |
[14:08] < Davbo> done |
[14:09] < j_baker> Ok, what you'll do next is type ./make-unix.sh That will give you lots of text. :) |
[14:09] < j_baker> This will create an executable in dist called kwserve, so all you have to do to run it is type dist/kwserve |
[14:10] < j_baker> Then, if you haven't run it before, it should ask if you want to install it. |
[14:10] < j_baker> All you have to do is hit y and if all goes as planned, it should run. |
[14:11] < j_baker> (FYI, it will put some files in your home directory) |
[14:11] < Davbo> alright, running |
[14:11] < j_baker> Did it give you "serving on port 8080"? |
[14:11] < Davbo> yeah |
[14:12] < j_baker> Ok, now try going to http://127.0.0.1:8080/simple |
[14:12] < Davbo> Hello from the write callable! |
[14:13] < j_baker> And I'm assuming there's a lot of other output as well? |
[14:13] *** vmlemon_ has joined #kamaelia |
[14:13] < Davbo> Yeah |
[14:13] < j_baker> FYI, the other output is the contents of the WSGI environment dictionary. |
[14:13] < j_baker> (which I don't expect to make much sense to you right now :) ) |
[14:13] < Davbo> Yeah, I've looked at the code for this |
[14:13] < j_baker> Good. |
[14:14] < j_baker> Ok, now what you'll want to do is open up ~/kpuser/urls.ini |
[14:15] < j_baker> You'll notice that there are three options under the [simple_app] |
[14:15] < j_baker> ...section. |
[14:15] < j_baker> regex, import_path, and app_obj |
[14:15] < Davbo> ah yes, i see |
[14:16] < j_baker> essentially what this says is "if the first part of the URL matches regex, from import_path import app_obj" |
[14:17] < j_baker> The root section decides which application to run if somebody just goes to http://127.0.0.1:8080/ |
[14:19] < j_baker> One other thing to note: some applications will require more data than the standard data here. |
[14:20] < Davbo> it looks fairly intuitive tbh |
[14:20] < Davbo> docs are good too |
[14:20] < j_baker> I put some other stuff on the wiki if you get lost. |
[14:20] < j_baker> But I'll leave you alone if you've got it from here. |
[14:21] < j_baker> (I'll get you a simple paste application though) |
[14:21] < Davbo> Thanks j_baker |
[14:21] < j_baker> np |
[14:22] < Davbo> I can see what's going on with the bit that confused me earlier this morning anyway |
[14:28] < j_baker> Yeah. A lot of the stuff in the WSGI code isn't very intuitive. :( |
[14:29] < j_baker> Part of it is that Kamaelia's HTTP code was written for a VERY specific purpose and thus has a few foibles. Part of it is that Kamaelia WebServe essentially has two URL routing mechanisms (you just have to deal with one though). |
[14:30] *** vmlemon_ has joined #kamaelia |
[14:31] < Davbo> I understand the HTTP stuff, well I understand that you've needed it to be written for WSGI to work |
[14:33] < j_baker> Well, it is pretty pluggable, so I didn't necessarily need to make any changes. |
[14:33] < j_baker> It's just that I dislike the way you interface with it. |
[14:34] < j_baker> And that also just so happens to be the hardest part to change, because you have to worry about breaking older apps. |
[14:36] < Davbo> Yeah, it's better to just tag on your own support code |
[14:36] < Davbo> seems reasonable anyway :) |
[14:40] < Davbo> "j_baker: Well, it is pretty pluggable," /me finds this with a lot of Kamaelia |
[14:44] < j_baker> Yup. That's the cool thing about it too. If somebody doesn't like WebServe, they can modify parts of it without modifying the rest of the program. |
[14:44] < j_baker> And they even have the tools to go off and just write their own. |
[14:47] < j_baker> Hmmm... I may have to hold off on python paste. I really don't know if I have time to get together a sample app before monday. |
[14:47] *** j_baker had forgotten why he hates Paste. |
[14:47] < Davbo> no problem |
[14:48] < j_baker> You have to use eggs for everything in paste. Which means even for a simple little "hello world" type application, I have to put together a config file, a distutils setup.py file, and an egg-info file. |
[14:49] < Davbo> Heh...I see what you mean |
[14:49] < Davbo> Yeah, don't bother |
[14:50] < j_baker> Yeah. If someone wants to do that, they can write the 5-6 lines of code themself for now. :) |
[15:09] *** bcarlyon|laptop has joined #kamaelia |
[16:19] *** vmlemon_ has joined #kamaelia |
[16:31] *** Davbo has joined #kamaelia |
[16:53] *** vmlemon_ has joined #kamaelia |
[20:57] *** j_baker has joined #kamaelia |