Pronoy Chopra A Pythonic life

Python

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...

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...

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...

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...

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...

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...

Lights Out

Idea: Simply turn on/off lights using your phone (over WiFi). Circuit: Have a microcontroller connected to a relay that acts as a switch in the wiring loop. I didn't...

F() objects and Model Managers in Django

So, I discovered something new. Even though class methods are accessible in the instance of the class, there are a few things that are different in Django. Turns out model...

Django multiple settings files

I remember while working at my previous job as python developer, the question on how to organize Django Settings for multiple users used to come up often. The thing about...

Experiments with Avahi and Python-Zeroconf

I finally got it working today. So I used Avahi to announce the services I had running on the Beaglebone Black. I had a flask server running just to test...

[Dev Log] Python Kivy: Part 1

I am trying to get a hang of Kivy, the cross platform Python UI kit. It looks stable and there are some really good examples out there. The good thing...

[Dev Log] Knock : Part 6 - My massive mistake

So I used ATTiny2313. For a project that depends upon Analog To Digital Conversion. I USED A CHIP THAT DOESN'T HAVE AN ADC. But the good thing is it took...

[Dev Log] Knock : Part 4

AVR USART So I've been working with AVR USART today and I talked to some of the guys on #avr on freenode. Turns out _BV() is not a good way...

[Dev Log] Knock : Part 3

So I am lazy and I like working on a linux environment. Don't get me wrong I love the Atmel Studio, it's got a lot of stuff, it's easy to...