I am developing a django app which will run on the raspberry pi 3 in production. I must know at the start of the app if its running on raspberry, or in dev environment. In dev i use fake sensor data instead of the pins. Until now i used this method: from sys import platform as _platform test_environment = "win" in _platform or "darwin" in _platform This was working nice for both my pc and mac, but now i would like to deploy this to an ubuntu webserver online. Raspbian is also a linux dist, so i need something else. This is my currently working solution, but it hurts me deep inside. Any suggestion to make it better? try: import RPi.GPIO as gpio test_environment = False except: test_environment = True Continue reading...