Sharing is Caring 3/100 Days of Code
If you’re going to be a programmer, you should have some background in IT.
I ran into another wall in the SQL Relational Databases course. I set up my virtual machine running Ubuntu so I could create databases and run SQL queries locally via Python. This is better than using the Udacity course page since it lets me work offline any time I want.
Everything installed without a hitch. But I couldn’t see my course work. Vagrant is supposed to allow me to sync local directories with the virtual machine. However, whenever I logged in, I couldn’t see the project files. I uninstalled and reinstalled Vagrant at least three times. I even went so far as to manually configure the shared folder directory in Virtualbox JUST to be sure it would work. No dice. But it did point me in the right direction.
When starting a virtual machine in the terminal, the shared folder settings in Virtualbox were reset back to C:/ or the root of my hard disk. Even though I manually changed it to the vagrant project folder, it kept resetting to the root directory. Furthermore, when starting the virtual machine in the terminal, I noticed some interesting output in command promptĀ
I had a feeling something was telling the Virtualbox C:/ was my shared directory. And that something could be changed to follow my directions.
I opened the Vagrantfile Ruby file located in the parent directory of my project folders. Sure enough, this was the configuration file I needed.
There was a line containing code related to the synced folder that read:
config.vm.synced_folder “/”, “/vagrant”
It seemed the two fragments of code in quotes contained arguments for the sync folders. The second one obviously was the name of the folder. That meant the first one was the local directory I wanted to sync. Since it only contained a forward slash, I assumed it meant the root directory.
I updated it with the directory of my project files and saved my changes. After restarting the virtual machine and navigating to the /vagrant folder, sure enough, my local projects appeared!
It took a lot of experimenting and digging, but I have to admit, it was fun troubleshooting this issue. Now that my files are accessible, I’m ready to continue learning about Python and SQL!