PythonAnywhere vs Heroku


Heroku was originally a Platform as a service that helped Ruby developers deploy their Rails applications. Recently they branched out into supporting other interpreted languages like Python. So now that Heroku are stepping directly on our toes we thought it would be good to compare us directly to them and maybe help people decide, depending on their needs, who they should go with.

Key differences

PythonAnywhere starts as a fully configured Python environment. Most of the system packages are the latest versions and have been tested to work together.

Heroku on the other hand is more of a blank slate. You tell it which Python packages to pip install via requirements.txt.

PythonAnywhere behaves more like a traditional server. You have local storage that persists and you can ssh in or use a web console to look around, edit config files, or read logs. This despite the fact that it is really not a traditional server. Different parts might be running on different servers and your web applications are never running on the same physical machine as the one that a console is open upon.

In comparison Heroku creates a separate linux container for each web app you start up. Well, in fact for each dyno as well. That is why you cannot use a local file based database like SQLite and why you need a special command line tool to view the combined logs rather than just opening bash and running tail -f /var/log/my_app.log.

These approaches are very different. We chose to do it this way because we want to provide an environment that lets you serve Python webapps while also letting you code Python as if you were using a development server. PythonAnywhere is much closer to the experience you would have if you had started and configured your own VPS. Because of this it would be easier to migrate to a pure VPS provider in the future if necessary.

WebSockets?

Due to the way both platforms route requests neither of us can offer websockets at the present.

Pricing

Heroku charges per dyno. This is directly equivalent to a PythonAnywhere worker for your webapp.

Our free plan gives you one worker for a single webapp. Paid accounts get more workers per webapp. So the Web Developer account on PythonAnywhere can have 2 webapps with 3 workers each. On Heroku 3 web dynos costs $71 / month as of today. If you wanted to run four webapps with 3 dynos each that would cost $395 / month on Heroku. You can review our current pricing for a Web Developer account and sign up for one here.

How many workers you will actually need depends entirely on how busy your web application is and the efficiency of the code. There really is no general answer and we can consult with you to add more if required

Databases

PythonAnywhere currently offers MySQL for free accounts and a Postgres option for paid accounts is coming soon. Heroku offers a number of database plugins but not SQLite.

Uploaded user media?

This isn’t possible on Heroku. They recommend that you use a third party storage provider. This is different from PythonAnywhere. Despite the fact that your web workers and your consoles are running on different actual machines we merge the storage and persist it across restarts. So writing a gallery app and saving your users photos to disk is possible without also paying someone else to store your data.

NoSQL?

Heroku has us beat there. PythonAnywhere does not integrate any key value stores at present. Well apart from letting you write your own to disk. However it is possible to use 3rd party providers from within your PythonAnywhere cluster

Conclusions?

PythonAnywhere and Heroku don’t compare exactly. Heroku is a single purpose site for running a process via one of their dyno workers. Whereas PythonAnywhere fills a role that is more like a development server. I also worry about lock in with Heroku’s unique workflow. The same could be said for PythonAnywhere but since we are more similar to a configured VPS it would be easier to migrate to a pure VPS provider like AWS or Rackspace. The first dyno is free but each subsequent web worker process costs around $17. Which is quite expensive if you want to try out multiple ideas simultaneously.

Interested in feedback, I’ll update this post if there are any errors so feel free to point them out!

comments powered by Disqus