Pronoy Chopra A Pythonic life

Django

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

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

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

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

Deploying Django on Nginx using Gunicorn, Postgres and Supervisor

So I finally built my blog on Django. I've been working on this for quite a while. My code is on a private repository on Bitbucket right now because I...

Migrating from Django datastore

I moved to Ghost. Now I have to get the posts that I wrote using Django for my previous deployment. I am going to have to dump data here and...