Working with Django and Flask on Nitrous.IO

Working with Django and Flask on Nitrous.IO

by Real Python django flask tools web-dev

This is a guest post by our friend Greg McKeever from Nitrous.IO.


Nitrous.IO is a platform which allows you to spin up your own development environment quickly in the cloud. Here are a few key advantages of coding on Nitrous.IO:

  • Save countless hours (or days) of setting up your Windows or Mac OS for development. Your Nitrous box comes pre-loaded with many tools and interpreters, so you can start coding immediately.

  • Your code is accessible from any computer or mobile device. Edit code via Web IDE, SSH, or sync locally and use your favorite text editor.

  • Collaboration: Nitrous provides a way for you to share your development environment with any other user. If you are running into any issues with your project and need help, you can invite a friend to your Nitrous box to edit and run your code.

Getting Started

To get started, sign up at Nitrous.IO. Once your account is confirmed, navigate to the boxes page and create a new Python/Django box.

Nitrous.IO "New Box" Screenshot

There are many tools and interpreters which are included with the Nitrous box, and at the time of writing this you will have Python 2.7.3 and Django 1.5.1 included with your dev environment. If this is what you are wanting to start working with then everything is ready to go!

If you are looking to use a different version of Python, Django, or utilize another framework such as Flask, keep reading.

Setting up Python 2.7 with Virtualenv

Virtualenv allows you to create an isolated environment in order to install specific versions of Python, Django, and also install other frameworks such as Flask without requiring root access. Since the Nitrous boxes do not offer root at this time, this is the best route to go.

To view the available versions of Python available, run ls /usr/bin/python* in the console. Create a new environment with Python 2.7 by running the following command:

Shell
$ virtualenv -p /usr/bin/python2.7 py27env

You will now want to connect to this environment:

Shell
$ source py27env/bin/activate
Nitrous Virtualenv Setup for Python 2.7

If you decide you want to disconnect from this environment at any point, type deactivate in the console.

Since you are in an isolated environment, you will need to install Django and any other dependencies that were available outside of your environment. You can check which modules are installed with pip freeze.

Installing Django

To install the latest official version of Django, you will want to utilize pip:

Shell
$ pip install Django

Installing Flask

Installing Flask is just as easy as installing Django with pip. Run the following command to install the latest official release:

Shell
$ pip install Flask

That’s it! You can verify the installation by running the command pip freeze, and locating Flask in the list. You are now ready to start your course here at RealPython.

One thing to remember is that you can always disconnect from Virtualenv by running deactivate in the console. If you named your Virtualenv session ‘py27env’ as seen in this article, you can always reconnect by running source py27env/bin/activate.

🐍 Python Tricks 💌

Get a short & sweet Python Trick delivered to your inbox every couple of days. No spam ever. Unsubscribe any time. Curated by the Real Python team.

Python Tricks Dictionary Merge

Master Real-World Python Skills With Unlimited Access to Real Python

Locked learning resources

Join us and get access to thousands of tutorials, hands-on video courses, and a community of expert Pythonistas:

Level Up Your Python Skills »

Master Real-World Python Skills
With Unlimited Access to Real Python

Locked learning resources

Join us and get access to thousands of tutorials, hands-on video courses, and a community of expert Pythonistas:

Level Up Your Python Skills »

What Do You Think?

Rate this article:

What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment below and let us know.

Commenting Tips: The most useful comments are those written with the goal of learning from or helping out other students. Get tips for asking good questions and get answers to common questions in our support portal.


Looking for a real-time conversation? Visit the Real Python Community Chat or join the next “Office Hours” Live Q&A Session. Happy Pythoning!

Keep Learning

Related Topics: django flask tools web-dev