How Kerberos Works

Kerberos is a computer network authentication protocol that was developed by MIT. An open source, free implementation is available from MIT as well as commercial implementations from other vendors. Kerberos is the native authentication protocol in Active Directory. Here is how the protocol works: In Kerberos, there is no communication between the resource (server) and the […]

django – ‘int’ object has no attribute ‘keys’

Being new to Django, sometimes I face interesting problems. If it is very late and you are very tired, It may not always be easy to see the problem looking at the displayed error message like this int’ object has no attribute ‘keys’ error message I got in cursor.execute() method 🙂 This error was thrown on the […]

Django NoReverseMatch Error

Django’s reverse method can be found under django.core.urlresolvers (new versions: django.urls). To be able to use it you should import it like so:

reverse method is used to generate urls so that you can use them in your template files, model methods, view methods etc. Why do we use them? We use them not to […]

What is “related_name” used for in Django

related_name is an attribute you use while defining relations like many-to-one, many-to-many, one-to-one etc. The value of this attribute is used as the name of the reverse relation between models. Example:

Here we define a many-to-one relation using a Foreign Key. A Site can have many Pages. The relation from a Site to its […]

Python – Difference between “.append()” and “+= []”

In my new Django project, I was trying to append a list of tuples (which contained more than 1 tuple in it) into another list of tuples. Then I got this error: ValueError: too many values to unpack (expected 2) I was using .append() method to perform this operation and apparently that is exactly where the problem […]

Django Error – django.db.utils.OperationalError: no such table

Django “no such table” error of death.. I recently encountered this “no such table” error while trying to run makemigrations command on PyCharm. I dropped database tables related to my app, cleaned django_migrations table for this app, cleared migrations folder as described in this post: http://big.info/2016/07/django-clear-migrations-re-migrate.html. Then I ran makemigrations… No such table.. I did lots of […]

Difference between a Framework and a Library

Recently, I heard 2 of my friends talking about the difference between a framework and a library, and I thought some may need a clear explanation to see the difference. Check out the simple diagram below. Library A library is essentially a set of functions that you can call, these days usually organised into classes. Each […]

PyCharm – Django Debugger Won’t Stop At BreakPoints

Debugging a Django project in PyCharm is actually quite easy. All you need to do is add couple of breakpoints and hit that little debug button you see at the top right corner of the IDE. Now when you run your app, PyCharm’s Django debugger should stop at those breakpoints, right? Nope, not that straightforward. […]

Django – How to Clone a Virtual Environment

I wanted to write 1 more post in 2016 before the year ends. So, here it is 🙂 Let’s talk a little more about Virtual Environments. If you have a virtual environment you can back it up and re-create it later with the exact same installations in it. No need to worry about what and which […]