Setting Up Django



Python is one of the first supported runtimes on Cloud9 IDE. Many of our Python users wanted to have Django supported out of the box, so we’ve added a workspace type for Django that actually installs and creates a simple Django+MySQL application just ready to Run!

To Create a Django workspace, follow these steps:

  1. Select the “Python / Django” workspace type, choose a name for your workspace and “Create Workspace”

  1. Once your workspace has been created, perform a migrate then start the Django server from the terminal (bind to host $IP and port $PORT):
python migrate
python runserver $IP:$PORT

The terminal will then hint the application URL to access your application.

  1. Copy the link to a browser tab, or open the in-IDE previewer from ‘View -> Dock Panels -> Preview Apps’ to see the Django welcome page:

Your Django application is automatically configured to use a MySQL database for models persistence. If you like, you can use SQLite or PostgreSQL instead.

To start your workspace-hosted MySQL (as previously posted in MySQL for every workspace), type in your terminal:

mysql-ctl start

Sync installed applications models to the database:

python syncdb

While following the Django tutorial, I enabled “Django Admin Interface” for models (Poll and Choice) and here is what it looks like:


  • The created workspace is using Python 2.7 and Django 1.9.
  • The Django website has a nice tutorial to start developing Django applications.
  • Django template development with Cloud9′s previewer makes it a very neat experience.
  • You can install ‘pip’ (to help you install python modules) using the Terminal:
curl | python

Tutorials - Table of Contents

These tutorials are all super helpful! C9 and Brady FTW. Think you have a typo there though…


Good catch! Fixed now :thumbsup:


Also, looks like you have django 1.9 installed now


How do you deploy django apps from C9?


I think it would be nice to add the settings to work with Mysql. First, use the following command:

sudo pip install mysqlclient

In file

    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'c9',
        'USER': os.environ["C9_USER"],
        'PASSWORD': '',
        'HOST': os.environ["IP"],
        'PORT': '3306',


python migrate


Thank you for ur help.


The current version of django is way too old, cannot use it for production. I tried to upgrade it and I got this factual system error
Command python egg_info failed with error code 1 in /tmp/pip_build_root/django
Storing debug log for failure in /home/ubuntu/.pip/pip.log

I also tried to update python version to 3 in preferences and it just ignores what I do. I go to the shell and it keeps saying it is 2.7

Is it too much to ask that you have a version that is not years old?I have requested this by email twice. thanks.