Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

Learning Django with OpenShift

May 14, 2013
Scott McCarty (fatherlinux)
Related topics:
Kubernetes
Related products:
Red Hat OpenShift Container Platform

    Background

    The goal of this article is to use the OpenShift Platform as a Service (PaaS) as a learning platform for Django. Most of the technical articles out there about running Django on OpenShift assume the user already understands how to administer Django environments and projects. This article is written from the perspective of someone who has done some python programming and wants to learn some Django without doing a bunch of setup work.

    Since each OpenShift Gear "...is a container with a set of resources that allows users to run their applications", a user can ssh in to test, troubleshoot, debug and learn. This turns out to be quite convenient for learning Django.

    Django Quickstart

    First, we must deploy an OpenShift application. The deployment is completely automated with the Django Quickstart. Once completed, the web interface will return all of the connection information necessary for Django, Git, and SSH. Estimate 5 minutes.

    https://www.openshift.com/quickstarts/django -> Deploy Now

    Screenshot-Django-Quickstart

    Learning Environment

    Once the application and framework are set up, it's time to log in, do some basic configuration, and set up a developer workflow. This will allow us to focus on learning Django.

    Use ssh to connect to the OpenShift Gear and set up a few things. Luckily, most of the work is done for you by OpenShift. Use the connection information provided for your Gear when the OpenShift application was created in the last step.

    ssh 5179e2c7500446ddb7000023@django-fatherlinux.rhcloud.com
    Each OpenShift Gear has a small data directory where your application's database is stored. Conveniently, this can also be used for scratch work. Clone your application's git repo to your data directory. This is not recommended for a production application but will allow you to start learning Django from a Mac, Windows, or Linux Desktop without worrying if the correct version of Django is installed locally.

    git clone ~/git/django.git/
    Configure a few environmental variables to make your workflow easier

    cd ~/app-root/data/django/wsgi/openshift
    echo "cd ~/app-root/data" >> ~/app-root/data/.bash_profile
    source $OPENSHIFT_HOMEDIR/python-*/virtenv/bin/activate

    Here are a couple of tests to verify that the Django environment is working correctly:

    python -c "import django; print(django.get_version())"
    python manage.py shell

    Practice Workflow

    Login from scratch and create a new Django Application to get comfortable with the workflow. These are the basic instructions to follow every time you connect to the learning environment. We are doing a couple of things here. First, we are creating the application with the Django admin utility, which creates a new directory. Then we add the directory to our GitHub repository and commit the change. Finally, we are pushing the change, at which point, OpenShift will take over and perform all of the necessary steps to make your application live.

    ssh 5179e2c7500446ddb7000023@django-fatherlinux.rhcloud.com
    source $OPENSHIFT_HOMEDIR/python-*/virtenv/bin/activate

    python manage.py startapp mytest
    git add mytest
    git commit mytest -m "Created test application"
    git push

    Start Django Tutorial

    The six-part Django Tutorial is great, but there are a couple of things to be aware of when working in an OpenShift environment. First, having your git repository checked out in the OpenShift Gear is only a good idea for a learning environment. Second, the portion of the tutorial called The development server will not work properly because the Django Quickstart configures and adds the OpenShift components necessary to start the Django application for you.

    ssh 5179e2c7500446ddb7000023@django-fatherlinux.rhcloud.com
    source $OPENSHIFT_HOMEDIR/python-*/virtenv/bin/activate

    At this point, you can run through the tutorial, modify the data model, and interact with components in the shell, have fun!

    Last updated: August 16, 2022

    Recent Posts

    • Testing infrastructure red teaming with abliterated models

    • Build an enterprise RAG system with OGX

    • Solutions for SELinux MCS challenges with GitLab runners

    • MCP servers vs. skills: Choosing the right context for your AI

    • How to route external and local LLMs with Models-as-a-Service

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.