As part of my Full Stack Web Developer Nanodegree at Udacity, we were assigned the project of building a multi-user blogging software.
Its intent is to teach an intro to backend programming.
I built Simple Blog, a simple blogging framework.
It is built with Python using Jinja2 template engine, and can be deployed to Google App Engine. It’s database is built with Google Datastore and connects to the application with NDB Datastore API.
To handle encrypting passwords and authentication, I used the Passlib Python library.
See a working example of Simple Blog: https://simple-blog-151718.appspot.com
Here is the GitHub repo for: https://github.com/byanofsky/simple-blog
What It Does
Udacity required some basic functionality to be included in the final project. This included:
- Users can create accounts
- Account passwords are encrypted and stored in the database
- Users can login and logout
- Logged in users can create new posts, or edit and delete their existing posts
I learned how to build this functionality during the Udacity course.
As recommended by Udacity, I expanded upon these capabilities by adding:
- Commenting – users can create comments; and edit/delete their own comments
- Liking – users can like other users’ posts, and unlike ones they have already liked
The course did not teach how to build this functionality; I had to learn these on my own to implement properly.
What I Learned
I won’t lie. I struggled through a few aspects of building Simple Blog.
But struggling through helped me learn quite a bit.
Here’s just some of what I learned:
- How to properly structure a Python program (Spencer’s post in Udacity forum helped a lot. If you are a Udacity student, you can view it in Udacity’s Forum)
- How to properly structure a Google App Engine application (Shout out to Sunil Arora’s gae-boilerplate)
- Securely encrypting user passwords
- How to work with the NDB Datastore efficiently (NDB Documentation)
- Using Python decorators to handle common functions such as checking if a user is logged in (this primer on Python decorators helped me understand this)
Ways To Improve
There are a few things I’d still like to do to improve upon this application:
- I’d like to introduce some CSS to give it basic styling. But because I want this to be a framework, I want the styling to be easily changed or customized.
- Right now when a post is displayed, it outputs as preformatted text. I’d like it to output HTML.
- Add more functionality to the like, such as showing who else has liked a post.
- Simple Blog was built to run on Google App Engine. I’d like to build it so it can run on other platforms (such as a server through AWS).
- While user passwords are stored securely, if someone copies a cookie from one browser to another, they can be logged in to a user’s account. I’d like to research an implement a way to prevent this. I believe tokens may help with this, but need to learn more about them.
- I want to build a more extensive user dashboard. Right now, user’s can log out and create a new post from the dashboard. It’d be nice to allow them to view their own posts, and view posts they’ve liked.
Photo Credit: NOGRAN s.r.o., Some rights reserved