josh.code

Posts

I have a Node.js and Redis book coming out soon!

I have a Node.js and Redis book coming out soon!
I have not been updating this blog like I should have been for about the last year. That is unfortunate. Although I feel I have a good reason. I have been writing a book! You can currently see the pre-order page at Packt Publishing. This book is almost 300 pages that will start the reader from an empty folder to a working, scalable application that is published to Amazon Web Services.

Paranoid WordPress

This is just going to be a quick post. This blog is hosted on WordPress. I am making this post as I just updated WordPress just the other day. It’s nice to be able to do it right in the admin site. To do this you will need to change the file permissions of the WordPress install. Many times in the forum any questions regarding file permissions will have some responses to set the folders to 755 or even worse 777 with the webserver user being the owner.

Django Rest Framework and Forms Reusing validation logic

Django Rest Framework and Forms Reusing validation logic
Django Rest Framework is great for creating an API. It allows you to quickly create an restful API while still giving you a lot of power. It uses Class based views that you can then extend. This creates an issue though. You most likely already have an entry point for your data: forms. Your forms probably have validation on them right now. Adding a new entry point will allow users to enter invalid data.

A Workflow Story

Bad workflows suck. This post is going to be a little different than my other posts. It is going to be a partially fictional story. I say partially becuase all of the events I describe have happened to me in one form or another. You open gmail, to check over your email as Aptana is opening. Another Amazon email. You only searched once for some info on a TV that your friend posted about buying on Facebook.

FormView is Broken (kinda)

FormView is Broken (kinda)
Have I dropped enough praise of Two Scoops of Django? You really should buy the book. I started with Django by going through the tutorial. It is a great tutorial, but I do have one issue with it. It focuses on function based views (FBV). I understand why. It is easier to understand these then the newer class based views (CBV). Because of this I had been using FBV in my projects.

ALLOWED_HOSTS in settings.py

ALLOWED_HOSTS in settings.py
This is going to be a short post. It deals with a specific issue I just ran into. I had an old project that I had started. I made the decision to start up development on it again. The project was running Django 1.4.3. There were some sites I had done in 1.5, but I had not migrated a site yet. I jumped into my requirements.txt and changed the line to 1.

Facebook App ID in Django

Facebook App ID in Django
I will walk you through on how to set them up so they change between environments, without changing any settings. Also, on the two different ways to add variables to the context in Django. Different Environments, One settings.py This idea comes from the 12 Factor App config. The 12 factor app is a way of developing an application to minimize differences in deployment. If you have developed a Django app for Heroku, you have followed some of these rules already.

Getting Back to Blogging

I have not posted anything here in awhile. My plan is to create a new post every month. I was previously attempting this and I was successful for a little while in 2012. The last two months I have been really busy. The first thing that took a lot of my time was my primary job. I work for a hospital. We have just finished out a huge project where we replaced the core application all the physicians and nurses use.

Python, not PHP

Python, not PHP
The first few posts of this blog dealt with PHP and Zend Framework. I am now leaving PHP behind. I am going to focus on using Python and Django (probably a few others: Flask and web.py look great for small sites) from now on. This leads to a question: why? First, I have dabbled in Python and liked it. I had created a few simple Google App Engine sites. I used webapp (an App Engine framework) to build them.