The following guide describes how to setup Raspberry Pi to connect to Wifi. It was tested on the following environment:
- Raspberry Pi Model B
- Edimax EW-7811Un USB Wifi dongle
- OS: Raspbian Jessie
Here are the overview of the steps:
from io import StringIO | |
from django.core.files.storage import Storage | |
from django.test import SimpleTestCase as TestCase | |
from override_storages import OverrideStorageMixin | |
# noinspection PyAbstractClass |
sudo su - | |
mkdir -p /opt/bin | |
curl -L https://github.com/docker/compose/releases/download/1.5.1/docker-compose-`uname -s`-`uname -m` > /opt/bin/docker-compose | |
chmod +x /opt/bin/docker-compose |
def get_count(q): | |
count_q = q.statement.with_only_columns([func.count()]).order_by(None) | |
count = q.session.execute(count_q).scalar() | |
return count | |
q = session.query(TestModel).filter(...).order_by(...) | |
# Slow: SELECT COUNT(*) FROM (SELECT ... FROM TestModel WHERE ...) ... | |
print q.count() |