What I Hate About Django After One Week (2020)

by manit January 08, 2020

I have been developing solutions on Microsoft's platform for nearly 2 decades. After college I started developing web applications with what we now call Classic ASP. The Microsoft stack I develop with are: Asp.net, C#, IIS, and SQL Server. As a challenge to myself, I am developing and deploying this Dango web application you are viewing on Linux. While I have decent Linux experience, developing and deploying a web application on Linux is quite challenging. You are required to do simple tasks through a terminal, executing command line operations, and using terminal based text editors. You must quickly become familiar with Putty, Vim and Nano. I needed a desktop environment to be more efficient in my development. It's just easier to copy, paste, delete, and modify, files and folders using a GUI. I eventually installed a Gnome desktop interface on the Ubuntu and accessed the Linux desktop through TeamViewer. I tried to install VNC Server but to no avail. While I still use ssh to access the server, I still prefer having a desktop. With much grief and some joy, I was able to develop and deploy a Django web application on Ubuntu. After 1 week this is what I hate about Django.


Scripting Language - Like and scripting language Python is prone to simple typos, objects can be assigned and then lack intellisense in your IDE. In the example below, knowing the datatypes and their properties and methods for self, args, and kwargs is not possible without referring to documentation.

def __init__(self, *args, **kwargs):
return

Silent & Deadly Errors - Typos can result in no exceptions thrown, templates will display "None" or empty strings making it really hard to troubleshoot. Exceptions shown on the web server is imprecise. You maybe pulled down a deep dark rabbit hole. The simplest of errors can cost you hours of troubleshooting.

Unrecoverable Exceptions - Exceptions can cause the web server to crash. You are forced to restart the dev web server or the Apache server

No code block identifiers - Python language has no start and end of code identifiers. Indentation determines end and start of code blocks for keywords like if and for statements. A single space can cause your code to run a muck.

You'll run into this exception quite often.

IndentationError: expected an indented block

Django Dev Server - Developing a web application is heavily dependent on the Django development web server. You have to constantly check if the server is running, if it's crashed or not running you have to run a command line statement to run the server. You'll find yourself restarting the server often.

Command Line - Development heavy use of command line operations. You'll find your self in the terminal quite often.

Code Hierarchy - code namespaces is organized by folders and file names. You reference importing code by using folder names and filenam

Restrictive Development Pattern - development is restricted to routes and MVC. You cannot create an single python web page without creating a route and view. To be efficient in Django, you must learn and conform to recommended development patterns.

Django does not auto compile - Updating a python file or template does not auto recompile the code. If you make a code change in Linux you will have to execute a touch command on the Django HTTP middle ware file.

Database Migrations - If you are using the Django ORM, you are required to code your models in python then run migrations scripts in Django. If you get your migrations out of order or miss one it is very hard to sync your dev database with your prod database.