Uniform Interfaces in a Nutshell

The uniform interface constraint defines the interface between clients and servers. It simplifies and decouples the architecture, which enables each part to evolve independently. The four guiding principles of the uniform interface are:


Individual resources are identified in requests using URIs as resource identifiers. The resources themselves are conceptually separate from the representations that are returned to the client. For example, the server does not send its database, but rather, some HTML, XML or JSON that represents some database records expressed, for instance, in Finnish and encoded in UTF-8, depending on the details of the request and the server implementation.

Manipulation of Resources Through Representations

When a client holds a representation of a resource, including any metadata attached, it has enough information to modify or delete the resource on the server, provided it has permission to do so.

Self-descriptive Messages

Each message includes enough information to describe how to process the message. For example, which parser to invoke may be specified by an Internet media type (previously known as a MIME type). Responses also explicitly indicate their cache-ability.

Hypermedia as the Engine of Application State (HATEOAS)

Clients deliver state via body contents, query-string parameters, request headers and the requested URI (the resource name). Services deliver the state to clients via body content, response codes, and response headers. This is technically referred-to as hypermedia (or hyperlinks within hypertext).

Aside from the description above, HATEOS also means that, where necessary, links are contained in the returned body (or headers) to supply the URI for retrieval of the object itself or related objects. We’ll talk about this in more detail later.

The uniform interface that any REST services must provide is fundamental to its design.


Advantages of Cloud Computing

We live in a modern, fast-paced world where people want to have all things to be instant. Through the internet, it makes our work faster and convenient. For example, you can have remote access to your files and applications using the internet and it frees you from using storage devices like flash drives. Whereas in the past, people would run applications or programs from software downloaded on a physical computer or server in their building. With cloud computing, it grants people to access to the same kinds of applications through the use of internet.


According to a set of reporters tackling cloud computing, cloud computing is a concept that works hand in hand with mobile computing in order to truly achieve computing on the go. This basically grants users or consumers to have remote access to data, applications, and storage for convenience and frees them from physical hardware needs.


In other words, it is a delivery system that delivers computing. Examples of cloud computing include most of Google’s services like Gmail, Google Calendar, Evernote, Google Maps and so on. For me, cloud computing is a big help, especially that I am a busy person and I can access my files anytime and anywhere. This is a great use either for business or personal means. Cloud Computing is mainly categorized into three services including, software as a service (SaaS), infrastructure as a service (IaaS) and platform as a service (PaaS). Key characteristics of Cloud Computing are on-demand network access, scalability, greater security, measured service, and flexibility. The reporters also shared their reasons why there are several people who move to cloud computing. They mentioned a lot of benefits including unlimited storage capacity, device independence, increased efficiency, increased data reliability, lower computer cost, easier collaboration, etc,. Despite a number of benefits, there are also its disadvantages including it requires a constant internet connection, does not work well with a low-speed internet connection and has possibilities of data being lost or not secured.

Cloud Computing is one of the most popular breakthroughs in IT today. The “cloud” represents one of the most significant shifts that computing has gone through. I think that although cloud computing is lacking a bit in some aspects and needs improvement it is a new model and architecture so it still has an opportunity for future research and expansion.

Nowadays, it is clear that cloud computing has revolutionized how technology is obtained, used and managed. And all of this has changed how organizations budget and pay for technology services.

Cloud Computing has given us the ability to reconfigure quickly our environments to be able to adapt them to changing business requirements. We can run cost-effective services that can scale up and down depending on usage or business demands and, all of this, using pay-per-use billing. Making unnecessary huge upfront infrastructure expenses for enterprises, and balancing the possibilities of being a big enterprise or a new one.



There are multiple and diverse advantages, and most of them depend on the enterprises, the business and the needs they have. But, there are six of them that tend to appear in every case:

Variable vs. Capital Expense

Instead of having to invest in data centers and servers before knowing how they are going to be used, they can be paid when you consume computing resources and paid only for how much you consume.

Economies of Scale

By, using cloud computing, we can achieve a lower variable cost that we would get on our own. Cloud providers like AWS can aggregate hundreds of thousands of customers in the cloud, achieving higher economies of scale, which translates in lower prices.

Stop Guessing Capacity

When we make a capacity decision prior to deploying an application, we usually end up either setting expensive idle resources or dealing with limited capacity. With cloud computing, there is no more need for guessing. The cloud allows us to access as much or as little as we need to cover our business needs and to scale up or down as required without advanced planning, within minutes.

Increase Speed and Agility

Deploy new resources to cover new business cases or implementation of prototypes and POCs to experiment now can be achieved with a few clicks provisioning new resources in a simple, easy and fast way usually reducing costs and time and allowing companies to adapt or explore.

Focus on Business Differentiators

Cloud computing allows enterprises to focus on their business priorities, instead of on the heavy lifting of racking, stacking and powering servers. This allows enterprises to focus on projects that differentiate their businesses.

Go Global in Minutes

With cloud computing enterprises can easily deploy their applications to multiple locations around the world. This allows providing redundancy and lower latencies. This is not any more reserved just for the largest enterprises. Cloud computing has democratized this ability

Scaling #Python on Heroku: Deployment, part 1

It’s always good for a developer to have a couple of different deployment options under their belt. Why not try deploying your site to Heroku, as well as PythonAnywhere?

Heroku is also free for small applications that don’t have too many visitors, but it’s a bit more tricky to get deployed.

We will be following this tutorial: https://devcenter.heroku.com/articles/getting-started-with-django, but we pasted it here so it’s easier for you.

The requirements.txt file

If you didn’t create one before, we need to create a requirements.txt file to tell Heroku what Python packages need to be installed on our server.

But first, Heroku needs us to install a few new packages. Go to your console with virtualenv activated and type this:

(myvenv) $ pip install dj-database-url gunicorn whitenoise

After the installation is finished, go to the apilama directory and run this command:

(myvenv) $ pip freeze > requirements.txt

This will create a file called requirements.txt with a list of your installed packages (i.e. Python libraries that you are using, for example Django :)).

: pip freeze outputs a list of all the Python libraries installed in your virtualenv, and the> takes the output of pip freeze and puts it into a file. Try running pip freeze without the > requirements.txt to see what happens!

Open this file and add the following line at the bottom:


This line is needed for your application to work on Heroku.


Another thing Heroku wants is a Procfile. This tells Heroku which commands to run in order to start our website. Open up your code editor, create a file called Procfile in apilama directory and add this line:

web: gunicorn mysite.wsgi

This line means that we’re going to be deploying a web application, and we’ll do that by running the command gunicorn mysite.wsgi (gunicorn is a program that’s like a more powerful version of Django’s runserver command).

Then save it. Done!

The runtime.txt file

We also need to tell Heroku which Python version we want to use. This is done by creating aruntime.txt in the apilama directory using your editor’s “new file” command, and putting the following text (and nothing else!) inside:



Because it’s more restrictive than PythonAnywhere, Heroku wants to use different settings from the ones we use on our locally (on our computer). Heroku wants to use Postgres while we use SQLite for example. That’s why we need to create a separate file for settings that will only be available for our local environment.

Go ahead and create mysite/local_settings.py file. It should contain your DATABASE setup from yourmysite/settings.py file. Just like that:

import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))

    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),

DEBUG = True

Then just save it! 🙂


Another thing we need to do is modify our website’s settings.py file. Open mysite/settings.py in your editor and add the following lines at the end of the file:

import dj_database_url
DATABASES['default'] = dj_database_url.config()



DEBUG = False

    from .local_settings import *
except ImportError:

It’ll do necessary configuration for Heroku and also it’ll import all of your local settings ifmysite/local_settings.py exists.

Then save the file.


Open the mysite/wsgi.py file and add these lines at the end:

from whitenoise.django import DjangoWhiteNoise
application = DjangoWhiteNoise(application)

All right!

Heroku account

You need to install your Heroku toolbelt which you can find here (you can skip the installation if you’ve already installed it during setup): https://toolbelt.heroku.com/

When running the Heroku toolbelt installation program on Windows make sure to choose “Custom Installation” when being asked which components to install. In the list of components that shows up after that please additionally check the checkbox in front of “Git and SSH”.

On Windows you also must run the following command to add Git and SSH to your command prompt’s PATH: setx PATH "%PATH%;C:\Program Files\Git\bin". Restart the command prompt program afterwards to enable the change.

After restarting your command prompt, don’t forget to go to your apilama folder again and activate your virtualenv! (Hint: Check the Django installation chapter)

Please also create a free Heroku account here: https://id.heroku.com/signup/www-home-top

Then authenticate your Heroku account on your computer by running this command:

$ heroku login

In case you don’t have an SSH key this command will automatically create one. SSH keys are required to push code to the Heroku.

Git commit

Heroku uses git for its deployments. Unlike PythonAnywhere, you can push to Heroku directly, without going via Github. But we need to tweak a couple of things first.

Open the file named .gitignore in your apilama directory and add local_settings.py to it. We want git to ignore local_settings, so it stays on our local computer and doesn’t end up on Heroku.


And we commit our changes

$ git status
$ git add -A .
$ git commit -m "additional files and changes for Heroku"

Pick an application name

We’ll be making your blog available on the Web at [your blog's name].herokuapp.com, so we need to choose a name that nobody else has taken. This name doesn’t need to be related to the Django blogapp or to mysite or anything we’ve created so far. The name can be anything you want, but Heroku is quite strict as to what characters you can use: you’re only allowed to use simple lowercase letters (no capital letters or accents), numbers, and dashes (-).

Once you’ve thought of a name (maybe something with your name or nickname in it), run this command, replacing apilamablog with your own application name:

$ heroku create apilamablog

: Remember to replace apilamablog with the name of your application on Heroku.

If you can’t think of a name, you can instead run

$ heroku create

and Heroku will pick an unused name for you (probably something like enigmatic-cove-2527).

If you ever feel like changing the name of your Heroku application, you can do so at any time with this command (replace the-new-name with the new name you want to use):

$ heroku apps:rename the-new-name

: Remember that after you change your application’s name, you’ll need to visit [the-new-name].herokuapp.com to see your site.

Deploy to Heroku!

That was a lot of configuration and installing, right? But you only need to do that once! Now you can deploy!

When you ran heroku create, it automatically added the Heroku remote for our app to our repository. Now we can do a simple git push to deploy our application:

$ git push heroku master

: This will probably produce a lot of output the first time you run it, as Heroku compiles and installs psycopg. You’ll know it’s succeeded if you see something likehttps://yourapplicationname.herokuapp.com/ deployed to Heroku near the end of the output.

Visit your application

You’ve deployed your code to Heroku, and specified the process types in a Procfile (we chose a webprocess type earlier). We can now tell Heroku to start this web process.

To do that, run the following command:

$ heroku ps:scale web=1

This tells Heroku to run just one instance of our web process. Since our blog application is quite simple, we don’t need too much power and so it’s fine to run just one process. It’s possible to ask Heroku to run more processes (by the way, Heroku calls these processes “Dynos” so don’t be surprised if you see this term) but it will no longer be free.

We can now visit the app in our browser with heroku open.

$ heroku open

: you will see an error page! We’ll talk about that in a minute.

This will open a url like https://apilama.herokuapp.com/ in your browser, and at the moment you will probably see an error page.

The error you saw was because we when we deployed to Heroku, we created a new database and it’s empty. We need to run the migrate and createsuperuser commands, just like we did on PythonAnywhere. This time, they come via a special command-line on our own computer, heroku run:

$ heroku run python manage.py migrate

$ heroku run python manage.py createsuperuser

The command prompt will ask you to choose a username and a password again. These will be your login details on your live website’s admin page.

Refresh it in your browser, and there you go! You now know how to deploy to two different hosting platforms. Pick your favourite 🙂