Secret Santa – Python Flask Webapp

Hey all, sorry for the past quiet months. It has been quite hectic with my company moving downtown, changing positions, and ultimately trying to crank out and learn so really cool and exciting technology. As every with every winter, I expect to have a bit more downtime and hopefully I can share some cool things I have been working on in my spare time!

Today, I am excited to share with all of you a fun, but very basic (and I mean verrry basic) web app I wrote while trying to digest an exorbitant amount of Thanksgiving dinner. I was tired after Thanksgiving dinner and want to learn something new as well! Some backstory; every year, my family and I get together for Thanksgiving dinner and we do a yearly “Secret Santa” pool. With this being said, this is usually quite problematic as:

  1. Sometimes people draw their own name, thus making it public who is left in the pool
  2. Someone isn’t able to make it to dinner due to other arrangements so we need to draw the name and just tell them (but that is no fun…)
  3. Someone spills the beans on who they got thus potentially breaking the secret chain of who got who

In comes my idea; how about we do secret santa online this year? It sounded like a great idea, I would whip up a simple app that collect names and email addresses and shoots random emails out using Amazon SES. This would have worked if it wasn’t the fact that not everyone at dinner had an email address (primarily my grandparents). So I had to come up with a solution that solves all the three above existing problems, but also allowed folks without email to sign up as well.

With the goal set, I created a simple flask app that allows people to register their name and a unique passphrase. Once registered, users can check their status to see who they have been matched with. When it has been determined that all people have registered, the admin (me in this case) would go to a randomizer url and scramble all the people’s matches. Until the randomizer piece happens, users are told to check back later or poke the admin with a stick to kick off the match pairing. In my situation, I told everyone to register by noon Friday, I would do a shuffle at that time. Once the randomizer was complete, people can then check their pairing.

So after about 2 hours, I came up with the solution, implemented it, and had people up and running on AWS. It worked surprisingly well and even got a chance to show my younger cousin how it works! Best of of all, I have made the code open for you all to use and implement. I added a lot of “bootstrapping” files such as apache configs, sqlite3 setups, and even a sample WSGI file. Below you will find a list of technologies I used, as well as a number of improvements that could be done.

Hope this helps someone else out there as well! Happy Holidays all!

Technologies Used:

  • Python
  • Flask
  • Sqlite3
  • AWS (for EC2 primarily)

Potential Improvements:

  • Admin Interface
  • Secure Passwords
  • Allow for multiple pools
  • SQLAlchemy
  • Various Flask and Pythonic improvements

Sourcehttps://github.com/jvasallo/flask-secret-santa

2 thoughts on “Secret Santa – Python Flask Webapp”

    1. Web2Py is great, but this was just a light weight application, and I didn’t need all those batteries to be included.

      Usually it goes for me:
      Flask == Quick Simple
      Web2Py == Teaching and Learning
      Django == Long Term and Complex

Leave a Reply

Your email address will not be published. Required fields are marked *