Friday, October 27, 2006

django on windows mobile 5

Hey, I just got the web framework django running on a Windows Mobile 5 PDA. I'm running under python 2.5 from here.

There is a bit of messing about which I'll blog about later but mostly it's installing stuff and getting around the lack of the command line shell. The only other tip is to start the development server with --noreload.

As sqlite3 is available it should be possible to build a proper web app but I haven't tried that just yet.

Update: mentioned on the Django blog!

Wow, I am so proud to be mentioned on the django site, thanks very much.

Here's my startup script that lets you use the server over WiFi. To run it you open it in File Explorer:

import sys
import socket

ipPort = "%s:%d" % (socket.gethostbyname(socket.gethostname()), 8000)


from import execute_manager

import settings # Assumed to be in the same directory.

# so we can see any error

I installed Python on a compact flash card. Here's the layout from the "Program Files" directory down. I simply copied the django directory over from another machine.


Dewayne said...

Way cool! I have been playing with Python on my WM5 device as well and now I am truely inspired. Thanks for your efforts and willingness to let the world know. Please post more details when you get a chance, particularly if you get sqlite3 working.

Peter Marks said...

Will do. Glad to hear there's some interest.

I got it to share on the WiFi interface so we can use the app from desktops on the lan as well.

Unknown said...

Cool. BTW, I followed your link for Python 2.5 on Mobile 5, but only saw 2.2 and 2.3. Where's 2.5?

Peter Marks said...

I've fixed the link to Python 2.5 on Windows CE. Thanks.

paulkk said...

Hi, I'm new to pythonce. Could you please describe the installation process of pythonce+Django on PPC in more detail? Thanks a million.

Peter Marks said...

Not much to say. I installed Python to the compact flash card and dragged the django directory over as shown in the image.

Have a go and let me know if it doesn't work.

Unknown said...

I got it to work on an old iPaq 5500 under Windows Mobile 2003. Just one problem. When transferring the django folder, WM2003 converts all file and folder names that are 8 characters long or less to upper case. I had to change them all back to lower case. It took a while, but having done it, django worked fine with Python 2.5.

Peter Marks said...

I transferred the files by mounting the compact flash on my desktop (MacOS) and copying that way.

My understanding is that Windows CE (or whatever it's called this week) has "modern" long file name capabilities so I suspect the problem was in the software that transferred the files.

Thanks for the comment.

Unknown said...

That's the way that I did it. I put the SD card into the slot on my laptop (WinXP) and simply dragged the folder over. On the laptop, all names were in lower case, but on the iPaq some had been converted to upeer case. Put the card back in the laptop and they were all lower case. Bizarre.
One to look out for if you are using Windows Mobile 2003.

linuxtechie said...

Regarding sqlite3 under pythonce:

Although not used under django, however I had written a raw application that would use lissard template for generating html. For the same had used sqlite3. So yes sqlite3 worked there and should work here as well.

Unknown said...

I did it step by step but python said to me "ImportError: No module named".
That isn't cool to me... jejeje

Peter Marks said...

Gosh RĂ³mulo, this post is a couple of years old and Django changed a bit when it went 1.0. I'm sorry but I don't have Windows mobile any more.

If you figure it out please let me know.

Anonymous said...

^^ marxy

I am continuing with the latest version of django and it does work on wm 6.5.

Luka said...

If you get error 'ImportError: No module named' use this code to rename uppercased django files:

import os

def rename(dir):
names = os.listdir(dir)
for name in names:
nam = os.path.join(dir, name)

if os.path.isdir(nam):

os.rename(nam, '%s_' % os.path.join(dir, name.lower()))
os.rename('%s_' % os.path.join(dir, name.lower()), os.path.join(dir, name.lower()))

rename('\\Storage Card\\Program Files\\Python25\\Lib\\django')


windows 7 professional said...

Considerably, this post is really the sweetest on this notable topic. I harmonise with your conclusions and will thirstily look forward to your incoming updates. Saying thanks will not just be sufficient, for the phenomenal clarity in your writing. I will directly grab your rss feed to stay informed of any updates. Admirable work and much success in your business dealings!? Please excuse my poor English as it is not my first tongue.

Peter Marks said...

Indubitably, this comment is either one of the most notable I have been honoured with in recent times or alternately the product of some sort of automatic comment generation system designed to ascertain if moderation is switched on.

I shall await the influx of fascinating spam in the near future.

jual jam tangan said...

I wanted to thank you for this special read. I definitely savored every little bit of it