Staticfiles in Django 1.3 not working?

Wasted a lot of time on this today when I shouldn’t have done. If you find that your staticfiles in Django are just not working for you, when the docs say they should be, try this. The docs say here that: “This view is automatically enabled and will serve your static files at STATIC_URL when you use the built-in runserver management command.” Well, it doesn’t work for me. As per the example after I had…

Continue reading

Django/Postgresql – inserting new record doesn’t return id.

You have an old database and you find the following happens. [cc lang=”python”] >>> ap = ValidAirPressureCode(code=’9′, description=’9′, barcode=’9′, comments=’ 9′) >>> ap.save() >>> ap.id >>> ap = ValidAirPressureCode.objects.get(code=’9′) >>> ap.id 11 [/cc] In short Django doesn’t return the id of a newly inserted record. If you insert records in admin and choose to continue editing, you’ll get an error saying it can’t find a record with a null id. The problem (in my case)…

Continue reading