When I first encountered Django and tried it out, I thought it was absolutely amazing!
So I decided to rewrite my UniverseSite website as a Django application thinking that I could learn a thing or two along the way and that I would create this amazing new site quickly and easily.
I used this book to help me along.
I encountered two massive problems which has put me off carrying on.
1) Linking CSS and images.
In Django, there is a concept known as Templates. All the HTML pages are basically Templates that get given some data to render with. They can also inherit from each other which gives a very modular approach to making pages.
So I thought, I could simply put the link to my CSS. Nope. For some strange reason, this an not be done. The same is true for images. Nothing is explained or mentioned in the book and I spent hours trawling the Internet for a solution.
Eventually, I found one that was explained nicely but I have been told not to use this solution when I put the site into production! Basically involves routing all requests so that if I hit /static/content, it would be able to get my content from the static folder. Otherwise, it does not want to know.
Apparently, in production, there is an even more complicated method which involves using Apache to serve my static content! Why is it so complicated?! Why can’t I just link it in my template!! I wouldn’t mind if there was a place where it was all nicely explained but there isn’t!
2) Using MySQL.
Fine, I used the routing method for now and thought I worry about when I go live later. So I built a nice base template that I am happy with and was ready to build my navigation. This means I was ready to connect to the MySQL database for the first time.
I read the book and it tells me about Django’s database layer and how I can attach different engines without tightly coupling it and how I can just add to my settings file what I need.
Ah, but wait. I need to install an adapter for the engine that I want to use. OK, fine, the book explains where I can get the one for MySql from. I go there. Great, its a .exe file, easy for Windows! Download it. Run it. BAM!!
“You need Python 2.7 to run this”.
I am running the latest version of Python, 3.3. So I go back to their website, maybe I clicked the wrong installer? No. I go onto Google, maybe its somewhere else.
The website itself actually says “working on support for Python 3.” What the hell are you waiting for? We are on 3.3!!!
And nobody else seems to be able to come up with a better solution except for a couple unsupported Git projects.
So I decide to give this one a go since it seems to have the most people recommend it. But this came with its own problems. The README starts talking about changing some settings somewhere, I have no idea what it is going on about.
I try to use setup.py, and I get messages that some packages are missing. So back on the Internet I go and install yet another package just to install this other one. And then I go back, try again. BAM! Another error, I need a C++ compiler.
And now I am here. Is it me are things far too complicated?! Django was supposed to make my life easier but I am not sure. Symfony2 for PHP is another framework that is far too complicated!
I don’t think it is completely because I am on a Windows machine. Frameworks should be easy to install and manage, whether I am on an Ubuntu, Windows or a washing machine!
None of this compiling source codes, downloading packages and modules and packages to install the modules! Just simple code!
Django is right about one thing, you do spend less time doing boilerplate code, but you spend twice as much time setting it all up!
Maybe it is just me. I am sure someone who is familiar with Django wouldn’t have these problems.
I wanted to do UniverseSite and the app before the end of September. So I think I might just give up with Django and just rewrite it in PHP, a language that I am comfortable with and is easy to use! Who knows, maybe a framework will form out of this!