Pronoy Chopra A Pythonic life

uWSGI, Django & Nginx

It's a pain. Here's a quick run down of what I did so that I can remember to do it right the next time and not waste hours and hours...

Tackling Django 1.11's RawPostDataException

django.http.request.RawPostDataException: You cannot access body after reading from request's data stream So Django's request.body is apparently a stream now, which means it can be only accessed...

NodeMCU firmware build log

These are just some steps I took to build a custom firmware for my ESP-12E chip. It wasn't hard at all, just had to build it in a clean VM...

Running a Virtual box VM in headless mode

I cannot believe I haven't tried this before. Virtualbox VMs can run in a headless mode. This is perfect for running a linux server VM without having to turn on...

Django Rest-Framework serialization

Django Rest-Framework (DRF) is the go to library when it comes to creating production quality Rest APIs for a Django application. Recently I have been working on a bunch of...

Inconsolata-dz adds straight quote marks to Inconsolata

Looks like I am switching over to that font for my dev work. Here's a comparison: Looks so much better. I never understood why the silly quote marks. Source Font...

Accessing server side LAN devices over OpenVPN

I have been trying to setup OpenVPN for the longest time now. I've tried it on my spare Macbook Air but the server isn't easy to setup (if it's even...

Python 3.5.X base64 encoding

I swear to god, I am not dark, but I have pretty much thought about drowning myself ten times in the last hour trying to figure this out. So I...

Apt-get force IPV4

EDIT: Instead of just forcing apt to follow ipv4 it's better to make the pi enforce ipv4 for everything. Here's how you do that. sudo su touch /etc/sysctl.d/...

Scraping response from a Form submission using Scrapy

There have been times when I've wanted to keep track of content on the net, specifically track the changes in content. Python-Requests + Regex is the usual way to go, but...

Django per request permission using Django's Auth Framework

Django has a very stable auth system that includes a permission sub framework as well. It allows user to work with object level permissions which makes sense if every view...

Runtime Modification of Class Attributes in Python

Man, I love setattr. Today I had the pleasure on working on something really cool. A friend of mine recently wrote this amazing piece of boiler plate code that is...

Simple script to cleanup Reddit frontpage

I don't like logging in to view the Reddit frontpage. So I decided to get lazy and remove the posts I don't like once and for all. Nosleep and Twoxchromosomes...

Introduction to maps using Leaflet.js

I recently had the opportunity to work on "visualizing data on maps" at the university. I started using Leaflet.js because I just thought it had better tutorials. We basically...

Django magic with ForeignKeys

Discovered interesting stuff yesterday. Actually it should've been apparent. So when we add a ForeignKey to a Django Model, the model itself creates an attribute for the key name and...

Next step

I have been thinking about this for a while now and I feel I need to put it out there so that I can drive myself to doing it. I...

Django ORM Lessons: Optimizing SQL

I recently had the pleasure on working on a project that required SQL optimization. The data being pulled from the DB was taking quite a bit of time. The code...

Daemonzing a Flask Server

So I wrote about Lights out recently. I decided that I wanted to have the server run when the device boots up (in this case it's a Ubuntu running Beaglebone...

Local Support Added to Python-Particle

So proud to finally announce that Python-Particle v0.2 is done. It still lacks documentation. But it does have support to work with Local devices connected over serial. What does...

Python-Particle

So we've been using the Photon from Particle (formerly Spark) and their infrastructure is pretty great. Except, it's built in Node. Now credit where credit is due, Node is perfect...