Posts Tagged ‘django’

Shortcut Tutorials

Friday, November 6th, 2009

Probably the first real coder I met was at school.

He was just some kid in an older class who knew how to code the BBC micros that littered the computer room with the heavy metal door. This guy was a genius. Except he wasn’t really. He just learned a lot of stuff from old type-ins in BBC micro magazines. You’d describe him as the guy with glasses, but he didn’t wear glasses. You get the picture.

One of the most astonishing things I saw was that he abbreviated every single command he typed in, which was allowed, using a dot. Instead of typing “BASIC”, you could type “BA.”. My favourite was that he typed “RU.” instead of “RUN”. Eh? You haven’t even saved yourself a keystroke there. What was the point?
(more…)

Satchmo finally running

Sunday, August 10th, 2008

Woah, that wasn’t easy.

I managed to get it running using Django SVN trunk revision 8222 (pre-signals/dispatcher rewrite), and latest SVN Satchmo 1404.

It’s not easy on a PC to get the required files, got to be said.  Most of the easy_installs don’t work. 

I wasn’t sure where trml2pdf should be placed (install instructions: “put it where you want!” – thanks :-p).  I put the folder in python/site-packages, and tested with “import trml2pdf” at the python line.

Finally, all was running well and I started the shop, when I hit:
‘WSGIRequest’ object has no attribute ’session’

This is because I used the recommended setting.py almost directly.  However, their setting-customize.py doesn’t include the “standard” stuff.  I’ve no idea why – it should have everything needed to run.  Anyway, it missed the middleware settings for the sessions.  My middleware settings now read:

MIDDLEWARE_CLASSES = (“django.middleware.locale.LocaleMiddleware”,
                      “django.middleware.common.CommonMiddleware”,
                      “django.contrib.sessions.middleware.SessionMiddleware”,
                      “django.middleware.doc.XViewMiddleware”,
                      “django.contrib.auth.middleware.AuthenticationMiddleware”,
                      “satchmo.shop.SSLMiddleware.SSLRedirect”,
                      “satchmo.recentlist.middleware.RecentProductMiddleware”)

I still have some outstanding errors for the languages.  I had to set my LANGUAGE_CODE to “us” – pretty odd, because that’s a country code.  Doh.  Plus, I want proper English (GB), and I’ll have to make sure I can do that.

I don’t know if that’s connected to the errors I got when doing:
python manage.py satchmo_load_l10n

But I ignored that and it still seems to be running :)

Final note:  For a Django App, that demo store is bloody ugly ;-P

Update: Site looks better now – had to set the MEDIA_URL to ‘/static/’

Django + Satchmo: ImportError: cannot import name ImageField

Sunday, August 10th, 2008

I’m experimenting with Django for Dots Shop.  Satchmo seems to be the thing to use.

But it’s a real pain to install.  I keep getting the error:
ImportError: cannot import name ImageField

No-one on the Internet has mentioned this.  The only way I found to fix it was to search+replace in the Satchmo project for: 

from django.db.models.fields import ImageField

and replace with

from django.db.models.fields.files import ImageField

Four occurences.

I’m using SVN Django (a2), and Satchmo 0.7.