A guest post by Garry Polley, a Python developer devoted to creating remarkable apps for the healthcare industry, and the creator of an online mathematics curriculum called GeckoMathematics. Education is a thriving passion for Garry and it’s what he would do if he were not a developer.
When you start out with a Django app, usually the deployment mechanism is the last thing you think about. This is okay to do when your app is small or you do not plan to scale out the application very quickly. If there is a remote chance that your application will grow, however, I encourage you to think about deployment, as you do your developing. There are really two camps for deployments: easy deployments managed by a third party, or deployments that you manage yourself. We will look at the latter in this post, since places like Heroku or OpenShift make the former fairly easy.
Define the Type of Site You’ll Have
First and foremost, you must figure out what kind of site you’ll have. There are a few options:
- High traffic, dynamic content
- Low traffic, dynamic content
- High traffic, static content
- Low traffic, static content
You can use Redis or memcached for your backend. I recommend memcached right now for ease of deployment via chef. You’ll have to configure a node, but in the end you’ll like it. It’s pretty easy to get up and running. Just make sure you install chef on the server you want memcached on.
Now with the dynamic content route left, you’ll need to determine if you’ll have a lot of dynamic content. If you do have a lot, you’ll need more web servers. To make this easier, make sure you front with something like nginx. To make this setup easier, take a look at some documentation about the subject.
The image below is a very simple way to figure out how you should scale. Notice as you get more dynamic content, you should up the amount of processing power for your app tier. As you get more traffic, you should think about updating your proxy and caching layer.
In the end, you have two ways you can go about managing your application. You can let a service like Heroku or OpenShift take care of it all. Or you can manage it all yourself. Honestly, if you are not going to be getting a lot of traffic at first, I recommend you go the Heroku or OpenShift route first. As you get more traffic and users, then you should start to manage it yourself. However, if you go the Heroku route, make sure to manage the interactions between servers (db, app, proxy) yourself so you are not locked into having to use Herkou, which can get rather expensive.
There’s a lot to consider when creating an application, so make sure you don’t leave off deployment until it’s too late.
For more details about Django, see the Safari Books Online resources referenced below.
Not a subscriber? Sign up for a free trial.
Safari Books Online has the content you need
|Pro Django, Second Edition goes above and beyond other books, leaving the basics far behind and showing how Django can do things even its core developers never expected. By drawing on the dynamic nature of Python, you can write Django applications that stretch the limits of what you thought possible!|
|Introduction to Django is a video where you’ll learn the fundamentals of development with Django, generate a Django data model, and put together a simple web site using the framework.|
|Instant Django 1.5 Application Development Starter will get you learning Django by creating a web application step by step. Offering you a quick but comprehensive immersion into the world of Python development, this book begins with a practical exploration of the framework’s powerful mechanisms and tools and finishes your journey by taking you through the creation of one sample application.|
About the author
|Garry Polley is a Python developer devoted to creating remarkable apps for the healthcare industry. Before joining his current employer, Garry helped to modify and create an online mathematics curriculum called GeckoMathematics. Education is a thriving passion for Garry and it’s what he would do if he were not a developer. He can be reached at garrypolley.com.|