In this post we will be showing how to create a Django hello world in Jelastic. Our hosting provider is Reclaim Cloud.

Create a local Django hello world

# Make a directory with an empty README
mkdir django-test
cd django-test

# Create a .gitignore file
curl -o .gitignore

# Initialize a git repo and rename master to main
git init
git add -A
git commit -m 'Initial commit'
git branch -m master main

# Re-enter the directory so your shell prompt picks up it is in a git repo
cd; cd -

# Create a virtualenv and activate it
virtualenv venv
. venv/bin/activate

# Install the django module and write the dependencies to requirements.txt
pip install django
pip freeze > requirements.txt

# Create a new django project
django-admin startproject config .

# Update the SQLite database (although we won't be using this)
python migrate

At this point, we have Django ready for testing so let’s see if it’s working. Run python runserver and then browse to


Press Ctrl-C to stop the web server. Now let’s create what Django calls an application and customize the configuration so that it will run in Jelastic.

# Create Django app named "pages"
python startapp pages

# Configure Django to serve the pages application
sed -i '' "s/INSTALLED_APPS = \[/INSTALLED_APPS = \[\n    'pages',/g" config/

# Configure Django to run for all hosts
sed -i '' "s/ALLOWED_HOSTS = \[\]/ALLOWED_HOSTS = \['*'\]/g" config/

# Configure Django not to use a database
sed -i '' '/DATABASES = {/,+5 s/^/#/' config/

# Create a view
cat << 'EOF' > pages/
from django.http import HttpResponse

def homePageView(request):
  return HttpResponse('Hello, World!')

# Setup URL mapping in the pages app
cat << 'EOF' > pages/
from django.urls import path
from .views import homePageView

urlpatterns = [
  path('', homePageView, name='home')

# Set URL mappings for the root of the project
cat << 'EOF' > config/
from django.contrib import admin
from django.urls import path, include

urlpatterns = [
  path('', include('pages.urls')),

# Create to be used by Apache
cat << 'EOF' >
import os,sys

virtenv = os.path.expanduser('~') + '/virtenv/'
virtualenv = os.path.join(virtenv, 'bin/')

  if sys.version.split(' ')[0].split('.')[0] == '3':
    exec(compile(open(virtualenv, "rb").read(), virtualenv, 'exec'), dict(__file__=virtualenv))
    execfile(virtualenv, dict(__file__=virtualenv))
except IOError:

sys.path.append(os.path.expanduser('~') + '/ROOT/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'ROOT.config.settings'

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

Now’s a good time to test things again by running python runserver and browsing to


OK, we have our Django hello world app running locally. Let’s push it to a Git repository that we can later access from our Jelastic environment. On my organization’s GitLab instance, I create an empty project and then push my code up.

git remote add origin
git add -A
git commit -m 'django hello world'
git push --set-upstream origin main

Create a cloud app

Now we need to login into Reclaim Cloud and create our app.

  • Browse to
  • Login with your credentials
  • Click the New Environment button
  • Click Python tab
  • In the first column, click SSL
  • Toggle “Bult-In SSL” to On
  • In the first column, click the blue “Application Server” rectangle
  • Under middle columnb for “Application Servers”, leave all the default, which were
    • Reserved 1 cloudlet
    • Scaling Limit 4 cloudlets
    • Apache Python 2.4.46
    • Python 3.9.4
  • On the right column, set “Environment Name” to django-test

Here’s what it looks like.


Click Create button. This took about 2 minutes to setup.


Afterwards, I browsed to and saw the following.


Deploy our app

Now we want to deploy our Django application and set it up so that all we need to do is click a button to deploy updates from the Git repo. At the bottom, click Deployment Manager and then switch to the Git / SVN tab.


Then click Add Repo. A modal window appears and starts on a Git tab. Fill in the following.

  • Name: django-test
  • URL:
  • Branch: main
  • Check: Use Authentication
  • Login: git
  • Access Type: SSH Key
  • Select key: Add Private Key
    • Name: elijah
    • Key: REMOVED
    • Click Add

Note: Your details for the above may differ. If you’re like me and using a SSH key for accessing your Git repo, you will likely find your private key at $HOME/.ssh/id_rsa.


Now click “Add + Deploy”. This brings you to another modal window where you are asked to pick an environment to deploy to. I’ve selected my only environment.


From here, click deploy. This took 25 seconds. Go ahead and browse to


We can setup Jelastic to periodically poll our Git repo and do a pull when there are changes. Or we can use this button to pull those changes down on demand.


Explaining some gotchas

Walking through these steps start to finish shouldn’t take more than 10 minutes. But it took me hours to figure out how to get everything working. First, I want to give credit to, which I used to help me get started with Django. I don’t have a lot of experience with Django or using Apache with the mod_wsgi for that matter.

One thing that had me stuck for a while was getting the Git deployment working. The gotcha there for me was what to put as the username with the SSH key. The answer was to use just git as show above.

The other thing that had be stumped for a while was how to properly connect Apache to Django. I’m used to using Gunicorn to run Python apps and typicaly Nginx as a proxy. But Jelastic doesn’t have that setup out of the box so I tried to work within their default configuration. The first key to figuring this out was to look at the environment variables.


Here we see WSGI_SCRIPT, which points to /var/www/webroot/ROOT/


We can pop open a Web SSH console.


If we check the Apache configuration we find that it uses this environment variable to set Apache’s entry point for /.


The problem I had is that the hello world example I was following didn’t use a and none of the example files I was finding worked. That is until I found, where on step 6 under the manual instructions. The key was understanding what to set DJANGO_SETTINGS_MODULE to, which in my case was ROOT.config.settings. After finding that, everything else was fairly straightforward.