Saturday, October 12, 2019

Expanding to Linux, Apache, Postgres, Python, and Django in Google Cloud

I finally got around to learning Linux and Python for the second time. I tried many years ago at a friend's place but never went back after I messed up a build. This time it was way faster with Google Cloud.

I spent about half a day figuring out the free trial versus always free. In reality, I was trying to figure out and extrapolate the always free part. Because as a hobbyist, this was very intriguing part. So basically, I can spin up a small VM and Cloud Sql for free, of course up to a certain limit which I think is well below the traffic and usage that I will be working in.

I think this is great because I am mostly on to practice and learn. If I were to expand my projects, scaling up my projects looks to be kind of simple for both infrastructure and cost. Although I did not delve deep into how to do that exactly. But the costs seem rather reasonable on a personal level.

I spent the rest of the day learning the different parts of google cloud. I quickly went through some of the options then saw all the different types of OS and DB google cloud has to offer. Of course, I spent most of the time figuring out which Linux distro to choose (Debian) and database (Postgre).

I chose Debian because it was free and seemed to have good amount of documentation online. I chose Postgre because it is new to me (I have worked with Oracle, MySql, and MS Sql in the past) and appears to be gaining some popularity (and also been seeing quite a few on job posts).

The next day, I spent all day trying to install Python, Apache, and Django. I spent part of the day looking into which web server to use which I almost scrapped because Python had its own server. I could not get the Python web server to work properly because I did not know how to open a web browser to be local within my google cloud "space" (I am still unsure if that is even possible). I was not able to open the ports to access it from an external source.

I also spent a lot of time trying to learn all the Linux commands to install. I spent a good amount of time trying to find what I can do without super user (sudo) which I found to be almost nothing. I was eventually able to install Apache with Python by following directions and open it from my system's browser (outside of google cloud).

I then looked into Python IDE which then I stumbled across Django which I later learn is a framework for python web development. So then I attempted to install Django, but ran into a lot of issues. Because I already had Python and Apache installed, I was trying not to repeat certain steps or skip certain steps. Because I was not exactly clear on what needed to be done and things were not working, I deleted my Django project and tried to start over.

I had to start over a few times until I found a different site (https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-apache-and-mod_wsgi-on-debian-8) that eventually got me up and running. On the bright side, I am now a bit more familiar with a few basic Linux commands: sudo, nano, mkdir, rm, mv, cp, service, etc. At least I think they are Linux commands as opposed to Python or Apache commands.

I have not started any programming yet, but excited to eventually get to that point. I still need to learn a bit about the Django framework before I can really start. So hopefully, I will get some time to work on that soon. Also, I still need to find an IDE or text editor.


Reference

https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-apache-and-mod_wsgi-on-debian-8

No comments:

Post a Comment