Hi All, I've only just signed up to this group so i'm hoping my Re: subject links into the original chat about this.
Because i love the ease of development that django offers, i've been moving bits of django code to get an autoreloading jython service running. After finding a few other blogs for other people trying to move django to jython, i decided to post my work here so we might be able to merge our efforts. (maybe we could get some svn space somewhere) here is my trac page for my changes https://dev.archer.edu.au/projects/kepler/log/jython-django (changeset 124 is the most interesting) the changesets are a bit messed up since i have not updated all my files to reflect the current django-svn. below i'll post a description of all the things i've done so far for all who're interested. cheers --Tristan ---------------- just a quick note: i'm very new to python. I've only been programming in it for a few weeks now. so feel free to throw constructive criticisms at my code :) things i haven't done: since i'm not interested in using the models package just yet, i haven't moved any of that code to jython. but Leo Soto seems to be doing a fine job at this. because of this i've had to work around some of the references to the models package (ie. when the server validates the models) major things i've done include: ****** getting the autorealod module to work. this has been an interesting task. I started off by replacing the spawnve with java.lang.Runtime calls to spawn the new task. For which i has to spawn a few other threads to read the process's stdout and err. looking at the code as i type this i realise i can remove the loop starting at line 111, i think that's just remains of some debuging :). good how these things make you re look over old code :). also the sys.executable call in jython doesn't work the same as it does in python, so i had to dodgy that up a bit (if anyone starts their jython with a name other than 'jython' it will break this :)) i've also had to work around a jython bug (i've still got to find out if it's a known bug) with the modules. hence the try: except: in lines 53:81. I've just spent the last hour trying to reproduce the jython bug, for anyone interested, https://dev.archer.edu.au/projects/kepler/wiki/Notes#myjythonbug . this is just a temporary spot till i find the respective jython ticketing system to throw it into :) now where was i... So, After these changes, the reloader works as expected. The only issue is that it's not as quick as the python one, since jython has quite a hefty startup time. so there's a bit of waiting around sometimes for the server to start up. but it's still completely automatic, which is excellent! ****** automatic java library pathing because i didn't want to have to manually load any new jars i want to use in my jython app into the sys.path, i added a LIB_DIRECTORY setting to the settings module. this is used in the setup_environ function (core/management/__init__.py lines 148:153) which lists the directory and adds all the jars it finds to sys.path. this probably needs a bit more work but no use cases have come up for me yet, so it'll stay like this till they do. ****** readline in the jython console so manage.py shell works this is more of a jython specific thing than django but i've just been messing with rlcompleter trying to tab completion in the jython console. i've got it working satisfactorily, but it still borks out every now and then. what i'm currently messing with: the simplejson modules. if a dictionary has javainstance objects in it, the simplejson encoder doesn't know what to do with it. i'm trying to work around this. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---