Ok so before I began this little project, I didn't even know what Django was. In just two days, I went from zero knowledge in Django, HTML or CSS into creating this:
It's a very simple blog site, but we all start somewhere and I'm proud of myself of what I have managed to achieve in such a short amount of time, starting from scratch essentially. I just finished this now and my head hurts so I thought writing my experiences as a blog post here would be a nice way to calm down.
Django... what's that?
I had heard of Django before, but had no idea what it was. I can't even remember where I heard it or why I should care about it. But a quick Google search allowed me to discover that some pretty dope sites are made using Django:
- Disqus
- NASA
- Spotify
- Youtube
- Eventbrite
To name just a few (check out the sources for more). As soon as I saw these names, that instantly made me think this is something I want to learn. I've always wondered how those websites were made so I thought it'd be cool to essentially get a behind the scenes look on how they work.
Learning Django from scratch
After a few more Google searches, I came across a documentation-type tutorial on Djangogirls. I'm not a girl but it was free and seemed pretty thorough at first glance so I thought let me just follow through with it.
The project was to make a simple blog site using Django and Python.
I followed the tutorial carefully over two days and followed along by making my own project as per the instructions. With every bit of code that I was asked to run or type, I would manually type them out rather than copy and paste them because I think it helps with learning if you actually do it yourself.
Plus you actually make mistakes and then learn how to format the syntax of stuff correctly. I think that if you just blindly copy and paste then you don't have a clue what's going on and you will get stuck very quickly when you run into errors.
I will say that halfway through the guide I started becoming a little bit lost and there was a point in the CSS section where I literally got so many errors:
It is very frustrating when you get errors, especially when you've done exactly what it said and have checked like 10 times but still have no idea what's going on.
Thing is, I started this tutorial to learn Django. I didn't realise it would involve also Python and HTML and CSS and Git and PythonAnywhere along the way. I have never learned HTML or CSS before but have learned a little bit of the basics of Python and Git.
I followed along anyway because the guide was pretty good in explaining stuff and I kind of enjoyed the challenge. All those errors in the CSS part literally did my head in though and I was so ready to quit but somehow I managed to fix the errors and the site worked in my localhost. It was very exciting!
Not going to lie, after the CSS part I was literally so lost and I didn't understand what was going on but I followed along anyway. I had also never used PythonAnywhere before so that was a new learning experience as well.
Frustrations
Ok so I'm fairly new to programming but have experienced enough errors to realise that errors are a given. Like errors are expected. No errors along the way means you did something wrong. I don't even approach things without expecting errors anymore. They are still annoying, but actually, the more errors you see, the more you learn. And some errors are actually helpful and tell you what's wrong. Or many errors are actually on Stackoverflow with a nice solution.
The annoying ones are where you literally can't figure it out and you're kind of stuck and don't know what to do. Yes, I don't have the confidence to post on Stackoverflow yet, mainly because I haven't build up enough programming knowledge to even understand some of the answers. And also there's a whole ettiquette on how to ask questions on Stackoverflow, which kind of seems scary for now. But I'll get to it one day!
Also, for some reason my live site on PythonAnywhere looks different to my localhost one:
Check it out: abhiyanbeta.pythonanywhere.com
The tutorial did try to explain, but I think I was in the "head hurts" phase so I kind of didn't pay much attention to it. Also the site does not have a SSL certificate so says "Not Secure". One of my pet peeves! Unfortunately the tutorial didn't mention how to fix that so oh well.
Have I mentioned my many CSS errors enough times? Well my CSS file also didn't work so the fonts and colours I picked didn't show up. Whatever I did, the site wouldn't refresh and update the CSS styling. And then randomly it worked at one point, then stopped working again. Very annoying as I had no idea what was going on so I just left it how it is. Doesn't look the nicest, but it is still something.
Conclusions
Yes the project was very very simple and I didn't make the next YouTube website, but it was such a relief to actually see it working after so many errors and headaches. So I would say it was a successful first project, considering how I was going to completely just give up at one point, and I learned many things along the way including Django, HTML, CSS and PythonAnywhere.
While I still don't fully understand how everything works, it was a good starting point to understand how websites actually work and I can only further build on my knowledge from here!