Wow...what an absolutely CRAZY week I had! I didn't realize that setting up a Django dev environment for my web app can be a total nightmare! Throw a few zombies in for good measure and it definitely was NOT a dream.
But I will tell you something. Through this nightmare I learned a whole lot of things. If setting up a dev environment is all a beautiful dream filled with rainbows and pink unicorns I would never have learned all that I learned. Not only did I learn more about how things work but I also learned something about myself. That I can indeed do it. That anything I put my heart and mind to is indeed possible.
So what have I learned and done so far during this crazy week?
The first thing I did was research the right tutorials for downloading Virtualenv and the Django framework. Virtualenv is a pretty interesting tool that helps you to create isolated Python environments. Therefore, multiple Python projects that have conflicting and different requirements can live and coexist on the same computer. Plus, all the tutorials I read highly recommended it because it made things much easier and organized.
I followed about six different tutorials so I could have consistent results. If one of the tutorials had a different step I tried to figure out why that particular step was done differently than in the other tutorials. And if the step worked then I made sure I wrote that specific step down on pen and paper in case I had to revert back to it one day when creating a different future project.
I decided to create my Django app in a Linux environment. One because I don't have a Mac. And two because I like Linux. My last laptop ran on Windows XP and when Microsoft stopped supporting it I had a few choices:
I decided to dual boot with Linux instead. I will tell you that was a HUGE learning experience for me and I had driver configuration issues from hell that made me want to do this a few times. Seriously!
But that is indeed another story for another day!
I had already installed a virtual machine before (VirtualBox) on my Windows 8.1 system (yes I bought a new computer since the dual boot XP computer was over nine years old) to play around with using a Linux distro. That way I didn't have to dual boot my entire computer. And when I downloaded Django onto that Linux distro in VirtualBox that was a total nightmare. There were some major configuration issues with the network.
On the bright side, at least I learned more about how the network works and what the difference is between what NAT (Network Address Translation) is and Bridge Adapter in the VirtualBox settings is and how they are used. So this was a nightmare that I learned from.
I decided to look into Vagrant because many of the configuration issues I was experiencing with VirtualBox would be much easier to deal with using Vagrant. So heck yeah...I'll try ANYTHING to get me past this configuration hell!
First what I did was download and install Git 2.7.1 64 bit version.
Next I downloaded and installed Vagrant 1.8.1 version.
Then I restarted my computer which was a very important step. After the computer restarted I opened up the Git Bash shell terminal and typed the following to verify the version of Git I was using. Again, you don't have to do this but I just like to be consistent and make sure that what I had previously downloaded and installed is the same thing I am using. In other words, I want to make sure that I'm doing things right! So I typed the following:
So far so good! I'm doing something right! Now it was time to make some configurations to Git. I wanted to make my favorite text editor Sublime Text 3 my default text editor in Git. So I typed:
git config --global core.editor "subl -n -w"
Next I learned that Git is much easier to use in the command line of the terminal if you enable colors so you can differentiate between different folders and other things. So I typed:
git config --global/ color.ui true
I also learned it's a good idea to configure your identity with Git in order for Git to attribute your commits to you. All I did was type:
git config --global username "PUT YOUR NAME HERE SURROUNDED WITH THESE QUOTATION MARKS"
git config --global user.email "PUT YOUR EMAIL HERE SURROUNDED WITH THESE QUOTATION MARKS"
Then, just to verify that everything I did took effect, I typed:
git config --list
This gave me a list of all the Git configurations I just did. Sweet! Everything is working according to my evil plan for world domination!
Then, to initialize a new box environment in VirtualBox by creating a new vagrantfile, I just typed:
vagrant init ubuntu/trusty/64
When I first did this my Git Bash shell terminal said the following:
A vagrantfile has been placed in this directory. You are now ready to vagrant up your first virtual environment! Please read the comments in the vagrantfile as well as documentation on vagrantup.com for more information on using Vagrant.
After this it was time to create the Vagrant box. To do this I typed:
vagrant box add ubuntu/trusty64
That took a little while to get added. But after the box was added to Vagrant it was now time to boot into my first Vagrant environment! All I did was type:
And these were my results:
I did it! I really did it! I learned that this Ubuntu Vagrant Box is headless, which means there is no GUI feature at all within it. It's just a head (the terminal) without a body. It sounds scary, I know, but it just takes a little getting used to. So instead of opening up VirtualBox and logging into Ubuntu from there all I have to do is open up Git Bash, then "vagrant up" to start the virtual machine and then "vagrant ssh" to get inside my Ubuntu terminal inside my virtual machine.
I began to understand that what "vagrant ssh" gives you is the Ubuntu terminal itself. That way whatever you install from the headless Ubuntu terminal will be automatically installed inside the Ubuntu virtual machine! And I don't even have to open up VirtualBox and manually open Ubuntu from there cause I can just do it all from the magic of the terminal. Is that not cool or what?
After all this work I deserve to celebrate! You know what that means right? It's time for the Woohoo Dance!