Env vars with Python and Django: environ vs django-environ

One of the struggles when learning new languages and tech stacks is knowing if you’re doing ‘the right thing’ because you don’t know enough yet to know any better. I’m working on a personal Django project and need to externalize some properties, so I need to read some environment variables.

I was following this article but instead of adding a dependency for ‘django-environ’ I somehow miscopied and pasted ‘environ’, which initially didn’t give any errors until I tried to run my app, and ran into this unintelligible error:

raise ValueError, "No frame marked with %s." % fname
SyntaxError: invalid syntax

I’m not too sure at this point what this means, but a quick Google found this article which luckily points out that ‘environ’ is for Python 2 and I shouldn’t be using that.

‘django-python’ apparently also needs a later python version than I’m using, so changing to python-environ and I’m up and running.

Serial connection to a Raspberry Pi: more useful info

From my previous post I noticed that I couldn’t re-connect to the Pi using screen after I’d disconnected using Ctrl-A Ctrl-D. Reading additional suggestions here, Ctrl-D is just a disconnect, it doesn’t end the process that’s attached.

Instead, use Ctrl-A Ctrl-\ and it will ask if you want to terminate processes using screen.

If you do detach, from here you can use this command to list processes attached to the serial port:

fuser /dev/tty.usbserial-11240

This will show a pid that you can kill, and then you can reattach again.

Raspberry Pi “Temporary failure in name resolution” errors every couple of days

I have a Raspberry Pi running PiAware headless (no monitor/keyboard/mouse) that I moved from wired ethernet to wifi, and every few days it becomes unreachable over wifi, but the activity lights appear to show it’s still up.

Looking through the syslog entries, around the time it appears to drop off the network there is this error that starts repeating:

Aug 31 00:00:09 piaware ntpd[14162]: error resolving pool 3.debian.pool.ntp.org: Temporary failure in name resolution (-3)

This post appears to see the same thing, and there’s a suggestion to turn off the power save function on the wifi:

sudo iwconfig wlan0 power off

I’ve given this a go and will monitor over the next few days.

MS Flight Simulator 2024: Around the World update 7: Continuing North-west through mainland Alaska

Following on from update 6, I continued heading north-west along the coast of mainland Alaska. I’ve gained an appreciation for how vast Alaska is. Most of my other legs flown so far I’ve easily passed through a couple of states or even countries in a single leg, but it’s going to take a few more hours to make it west to Russia and then on to Japan.

I’ve also been having a hard time keeping track of my inflight screenshots and matching where they were taken. A quick Google and I found the Geoshot add-on for MSFS, which automatically geo tags your screenshots, so I’ll be using that from this point onwards (once I’ve caught up with my backlog of the last couple of legs).

For this update I’m covering 2 legs:

Port Hardy CYZT – PAVD Valdez

PAVD Valdez – PAHO Homer

First leg:

Appreciating the scenery on this leg:

Second leg:

Continuing over Elmendorf AFB

Arriving at Homer PAHO: