Get your new Django based web app live with AppFog in minutes

Get your new Django based web app live with AppFog in minutes

You’ll have your Django web app up and running live on the internet with AppFog in a matter of minutes.

Here’s what you have to do.

  1. Start a project on AppFog.
  2. Clone the django-appfog-helloworld repository.
  3. Push to AppFog.

The repository is available at

Here’s what comes with this repo.

It’s a Django project that works out of the box (just download it and python runserver. If you have Django installed, it’ll work!). It’s already setup to serve static files. It’s all ready to use MySQL or sqlite3. It ships with Bootstrap and jQuery. Django’s admin app is enabled and ready to go. It has templates for 404 and 500 errors so you can quickly see how to get error handling working. And it has one app, named app_name, that demonstrates the core functionality of Django: models, views, templating, and forms, by collecting email address of early users to your site. It’s a rudimentary version of LaunchRock.

My hope is that it will work well both as start code and as reference code for how to get Django working quickly.

This template is great for quick and dirty websites. It’s perfect for a hackathon or for prototyping an idea with friends. And it’s a great template for getting started with Django, Bootstrap, and jQuery. But it’s not production quality in two key respects, security and scalability. Keep that in mind as you start building.

Now, let’s dive deeper into getting your Django app running.

Setting up AppFog

Register for an account at

Create a new “Django Python” app. Host it on AWS. And give it a name. I called mine “helloworld-django”. Let’s say you call yours name_of_app.

You’ll want to set up the af command line utility to make deploying your site easier later. On Mac or Unix this is as simple as gem install af. Windows instructions are simple too, and are available in the “Update Source Code” tab of your app on AppFog.

(Optional) Make sure you have a MySQL database service provisioned. To do this, log in to AppFog, choose your app, and choose the “Services” tab. You can either bind an existing MySQL database service to your app or create a new one. If you don’t have a MySQL database provisioned, the app we deploy in a moment will use sqlite3 as a fallback and should work just fine.

Cloning this repository

git clone

The web app is already all ready to be pushed to AppFog.

Before you go and push this website live, there are a few things you should do, all marked with TODO in the source code you just downloaded. These are the most important:

  1. Set your SECRET_KEY in
  2. Set up the ADMINS variable in
  3. Set default admin account credentials in
  4. Always be aware of whether DEBUG = True or DEBUG = False in This changes how errors are handled and you definitely want DEBUG set to false when your site is public.

Now you’re ready to go live!

Pushing to AppFog

Be sure to either run python collectstatic or place all your static files your static directory before pushing.

Log in to AppFog with the command af login. (Find instructions for setting up the command line tool in the “Update Source Code” tab of your app on

From inside the django-appfog-helloworld directory (which, by the way, you are free to rename) run af update name_of_app.

That’s it. Your site is live! You’re already collecting email address of beta-testers. Huzzah!

Testing Locally

To test locally, you’ll need to install Django.

To test your app locally, navigate to the django-appfog-helloworld directory containing

python runserver runs your app locally. View it at localhost:8000.
python syncdb sets up your local database by default in a file called dev.db.
python collectstatic copies all your static files into your static files directory.
python help for more.

Django is a Python based web framework with excellent documentation and tutorials. To learn more about Django, visit Happy hacking!

Comments? Head over to HackerNews.

Discussion 💬