GitHub’s Gitignore and Keeping DB Keys Safe

I’m working with a raspberry pi and I’m learning how to collect and manage sensor data.

There is a lot of data and that’s awesome, but dealing with remote persistent storage has helped me understand some good ways of keeping stuff organized and safe.

For example: ‘Keys’ or ‘Tokens’ (Not to be confused with the Late English writer Tolkien)

These are the keys to the door of your data.
To access the contents behind these doors, you must establish that you are the key-holder. One of the ways to do this in software is to create a long complicated string that can passed to the database so you can input or output data.

As long as you keep this token secret nobody will be able to mess with your data, or use it without having to pay for it.

Now this sounds pretty simple, but what if you use that token in code that is stored in a public repository on GitHub? This is essentially like printing a bunch of keys to your house and leaving them all over town. Not safe or smart.


1. We need to keep these keys separate from the rest of your code.
2. We need to keep the file that contains those keys away from your public repository.

To do this I created a separate file called that contains the strings of my tokens and a function called getStorageKey() that returns those strings.
Cool, we’ve satisfied our first goal.

Now we need to keep this file away from our repository. To do this we create a .gitignore file. This is a special ‘git’ file that allows us to specify which files will not be added to the remote repository.
To create a .gitignore file simply enter:

touch .gitignore

touch is a Unix command to create a file and update the access data, but not make any edits. Its the same as opening and closing without saving any changes.

After you’ve created this file you can edit it with any editor you like. I do it with sublime or VS Code because it helps me keep track of the separation occurring between visual studio and GitHub.

All you need to do is add on a separate lines the files you don’t want GitHub or just git to include.

When I first started all my .gitignore file had was:

Its expanded to include…

# the asterisk* acts as a wild card and will match any files with .pyc at the end
# anything that starts with a # is a comment and will be ignored from .gitignore

I saved this file (.gitignore) then added and committed it to the repository.

Now any files I add that end in .pyc or match will not be added to my repository. And you will not be prompted to add them when you check git status.

What about files we’ve already have added???

If we add the rule after we added the file we want to ignore… We need to remove it from tracking on GitHub using the rm –cache command.

This will not remove it from your computer, but it will stop if from being tracked by GitHub, and will essentially be treated as if it was removed from your repository.

To pull this off simply type this command

git rm --cached

In this case I’m removing a file named ‘’.
After checking our git status we’ll see that this file is going to be removed.

Commit the changes and push to your remote repo.

You’ll see the files are still in your local directory, but are no longer in the remote or local repository. Hooray for keeping things safe!

Please let me know if you have any questions or comments.
The documentation is excellent and I recommend you spend some time reading through the resources below to round out your learning:

touch (Unix)
GitHub .gitignore
If you enter: ‘git ignore –help’ in your gitshell you can find more helpful documentation about using .gitignore
Setting up Code for Powershell
Setting up sublime for Powershell

Evangelists in their natural habitat. Behind a booth and with a computer.

Azure Storage Exploration!

Hey There, during my work studying for my Azure Exam/Working on my Hug the Cloud project. I’ve found accessing and understanding my stored data a bit confusing.

Luckily, someone shared this link with me.
Here you can find a number of available azure file/table/queue explorers.

I chose the first explorer ‘Azure Storage Explorer’
It works well, is easy to use, and is totally free.

Once you have it downloaded you’ll be met with this page:

Use add account to create a new storage view.
Use add account to create a new storage view.

Go to your azure portal and find the info about your storage account in the ‘manage access keys’ section. (You can see the manage access keys button at the bottom of this photo):

From Azure Portal select Storage -> 'Name of Storage Account'
From Azure Portal select Storage -> ‘Name of Storage Account’

Use the name and the primary key and put that info in here:

This has made it much easier for me to organize my project data, and understand what’s happening inside my storage accounts.

Notice the three different types of storage? (Blob, Queue, and Table)

Looks pretty good
Looks pretty good

Let me know if you have any questions!
Had a great time at TreeHacks last weekend. Check out this link for some great Stanford hacks!

This is what a standard Hackathon table looks like at 4am
This is what a standard Hackathon table looks like at 4am

Getting Django Models into SQLite3 DB with VS

I ran into some troubles migrating/configuring my tables for a new app in my Django project.

I’ve been following this excellent tutorial, and ran into a bump I thought needed some clarification/update. As I’m not sure if the guide is up to date with the current version of Django.

Things I searched:
no module named models sqlall
django not creating db
models are not being created in sqlite3 Django
sqlite3 not creating table django
No migrations to apply
django sqlite3 unable to create tables shell
sqlite3 python package

Do these correlate with what you’re having issues with?
If so this was my solution.

First Install SQLite3 and add it too your Environment Variables -> Path
Install Page — Select: Source Code -> Zip for windows machines
I extracted it to C:/.
Now I have SQLite.exe in my root directory.
This is what the end of my Path looks like:
C:\Program Files\Microsoft\Web Platform Installer\;C:\SQLITE3.EXE\;

Sweet, now we can use SQLite in Powershell.

Configuration of Visual Studio:
Create a new app by right clicking on your Project file.
Then “Add” -> Select “Django App”
In this case my app is named book.

DjangoApp Solution Explorer

Sweet, now we have another Python app.
Go into your settings file and add it to the INSTALLED_APPS tuple.
eg. ‘book’,

Okay, now we’re configured make sure you’re SQLiteDB is properly configured as well.

‘ENGINE’: ‘django.db.backends.sqlite3’,
‘NAME’: path.join(PROJECT_ROOT, ‘db.sqlite3’),
‘USER’: ”,
‘HOST’: ”,
‘PORT’: ”,

Sweet, db all locked and loaded.

Next we’ll create a model.
Following along with the tutorial.
We go into: book -> and create our models.
class Publisher(models.Model):
name = models.CharField(max_length=30)
address = models.CharField(max_length=50)
city = models.CharField(max_length=60)
state_province = models.CharField(max_length=30)
country = models.CharField(max_length=50)
website = models.URLField()

Sweet. Model made. Let’s get it into our SQLite DB.

Alright now in DjangoProject1Hack (Where ‘ls’ will show db.sqlite3 among others)
We’ll be doing the migration.

1. Validate:
Run- C:\Python27\python.exe validate
2. makemigrations
Run- C:\Python27\python.exe makemigrations
Migrations for ‘book’:
– Create model Author
– Create model Book
– Create model Publisher
– Add field publisher to book
3. Sync (This just makes sure we add what’s missing)
Run- C:\Python27\python.exe syncdb
Operations to perform:
Apply all migrations: book
Running migrations:
Applying book.0001_initial… OK


Okay now we manage the db:
Run- C:\Python27\python.exe shell

Sample workflow in Shell:

>>> from book.models import Publisher
>>> p1 = Publisher(name=’Apress’, address=’2855 Telegraph ave’, city=’berkely’, state_province=’CA’, country=’USA’, website=
>>> p2 = Publisher(name=”o’reilly”, address=’10 Fawcett St.’, city=’Cambridge’, state_province=’MA’, country=’USA’, website=
>>> publisher_list = Publisher.objects.all()
>>> publisher_list
Publisher: Publisher object, Publisher: Publisher object

Yeehaa, let me know if you have any other questions!

What is it?
If you can guess what pun this represents, I’ll venmo you a dollar.