My first blog
This blog commemorates launching this site into production.
This portfolio site has been in the works for quite a while and I believe it is ready for the public. There are a lot of enhancements that I still want to introduce to the site, but baby steps.
This also marks my first finished public python project using Django web framework. A few struggles had to be overcome to make this website online as it is always with any beginner project.
Since this is going to be my hopefully continuous series of blogs, I am going to write my mistakes for my future self to look at and *hopefully* laugh, and for others to learn from.
Firstly: It was the problem of finding a better way to write python code instead of using notepad++ (which I admit is a genius piece of software) but I needed an IDE to mainly increase my productivity by automating some of the more mundane tasks, and to have an easier reference back to the different classes and files I am working with.
But I didn't choose the PyCharm since it is the paid version that supports Django and not the free one, so I ended up installing Visual Studio Code instead since it seemed the second best option with plugins that support Django really well.
However things didn't go as smoothly (as expected since I am writing about it here), and what went wrong wasn't actually the installation nor the plugins, but actually the Github extension.
So I actually have *quote* good *quote* past experience with Github, but I however always used Gui-supported Github with the help of either Github desktop or IDE extensions. But this extension didn't go as expected, as for some reason the .gitignore file was ignored (pun not intended) and everything was accidentally committed and pushed.
Making things worse is that instead of undoing my last commit (since I didn't know how), what I did was deleting the repository from Github, which of course led to VS-code freaking out about the repository not existing. That alone took a few hours of troubleshooting and I ended up creating a new repository and had to use the terminal to set that repository as the master one.
So for future reference: DON'T, I repeat don't commit any changes before checking what is being committed.
Secondly on the trouble list of new projects: biting more than I can chew. Learning to do both backend, frontend, hosting server config and domain stuff all at the same time is a really nerve-racking experience and prone to a whole bunch of mistakes, which is exactly what happened when setting my web server for the first time (I am using Nginx for my web server hosted on digitalocean).
Setting all the right values using SSH terminal is not something that I had past experience with, so that made things really tricky. However everything seemed to be going well according to the tutorial posted by digitalocean themselves, and there in the final parts of the tutorial I did my biggest mistake ever, I skipped a testing step for Nginx server configuration.
I ended up getting a 502 bad gateway when trying to access my website, which led me through a rabbit hole of googling the issue. In the end that took around 15 hours of research split into 2 days. The struggle ended when I decided to go through the all of the tests one by one and what do you know, the test that I skipped is the problematic one and showed me what I did wrong.
And as it is with every programmer struggle, it was a typo. Yes, a typo that brought my whole project down. I was supposed to route Nginx to Gunicorn socket and instead of writing my Linux username (aka the folder directory name), I wrote my Django app username.
So for future reference: DON'T, I repeat don't ever again skip a test in a tutorial.
Lastly on the list of major troubles (because I am not going to write about every single error I had): SSL certificate. This blog (and the portfolio in general as a whole) doesn't collect any data nor does it take in any personal data, for that reason I thought that I would wait until I move forward in Django before trying to implement it.
However some browsers or something in one of the many steps needed to get this site up, this website was getting redirected to https from http which my server was not ready to handle yet.
And of course in the spirit of every other problem I had, this problem took 2 days and more than 8 hours in a row of debugging until it was figured out, as the website was not loading on the majority of secure browsers but was still loading on some older devices.
This problem is a bit special because I didn't find it on my own and it actually required two other experts from the Programming Discussion discord server, who I will always be grateful for their much appreciated help that I repeat took around 8 hours to figure out.
What is a bit disappointing so is that I still don't know what is causing the website to be redirected so we (the discord guys and I) only figured out a solution for the symptom but not the bug itself.
So for future reference: Asking for help is necessary sometimes.
And that concludes my first blog and the first of a series where I write about my struggles in programming.
McpeCommander.June 30, 2020