How to host django app on pythonanywhere for free

hosting django app on pythonanywhere

So you developed a course project which you need to host somewhere so that everyone can access it.
Or you are working on some personal project and want to host it so that test users can test it.

What do you do in such scenario? You look for best hosting service provider. Right?
So what is best option to host your django app?

We tried multiple hosting providers and found out that best choice for a django app is why? Find out below.

Features of pythonanywhere:
  • Only Python Django focused hosting service provider.
  • Monthly payment option. $5 per month only.
  • $10 off on yearly payment.
  • IPython notebook to write code online.
  • Best customer care service. Immediate response on forum or via email.

Keeping above reasons in mind, we decided to help you host your first app on cloud.

Steps to host django app on pythonanywhere:
  • Once you are done with development and testing on local, commit your code to Github. Pushing code to Github have two benefits. Your code remain safe in case your local machine got corrupted and Transferring code from local to pythonanywhere is easy. Also version management is added benefit.
  • Create a free account on Login to your account.
  • In dashboard, click on web tab. Now add new web app.

Free account do not support custom domain names. So your app will go live on You need to upgrade to paid account for custom domain names.

  • Select the web framework on next screen. If you have already developed the app choose ‘Manual Configuration’. If you want to develop the app on server itself, choose ‘Django’.

  • Since we assumed that you have already developed the app and pushed the code to Github or Bitbucket, we selected ‘Manual Configuration’.
  • Select the python version on next screen. Final screen will inform you that you need to set wsgi file and virtual environment yourself. Proceed. Your web app is ready. Almost.


  • Now go to console tab and start a bash console.
  • Git clone the repository you pushed on Github/Bitbucket. You can use my project repository.  We will use references from this repository in rest of article. $ git clone
  • This will create the hellow-world-django  directory with project files in your current working directory.
  • In our article Building Django App in less than 5 minutes, we discussed how to install and create the virtual environment. Please follow same steps here to create virtual environment with python 3. Lets say name of virtual environment created is virtenv  .
  • Install Django in virtual environment. pip install django .
  • Now go to files tab and edit the  file. Set debug  to False  and Allowed host  to ["*"] . These changes will not show debug information in browser if something goes wrong. Allowed hosts setting will make sure which hosts can access the code. Setting it to * is not safe, but for now it will do the task. Make sure to change it to actual host name on production environment.
  • Now go to web tab and Fill source code directory, /home/code108/hellow-world-django/ in our case. Fill virtual environment directory, /home/code108/virtenv/ in out case. Save the settings.


  • You can define static and media directory and URLs but they are not required in our project.
  • You can also set the username and password on your app so that not everyone can access the website.

pythonanywhere setting password on site

  • Edit the WSGI configuration file. Comment the line in ++++++ Hello World +++++  section. Go to +++++++ DJANGO +++++  section and un-comment the lines so that code looks like as below.
  • Save WSGI settings file and reload the web app on web tab.
  • Open the link in new tab. Since we have helloworld  app inside our project, url should be <site-address>/helloworld/ . In our case it is . You can see the template you created on this url.

That is how you host on pythonanywhere server. For paid accounts process it a bit different. In paid account you are given CNAME which you need to update with your domain name service provider.

Refer this sort video on how to host hello world django app on pythonanywhere free account.


If you feel hosting on is smooth, create a free account today and host your first app and show it to your friends.

Please comment for any query.



(Visited 1,428 times, 1 visits today)

You must read this :

3 thoughts on “How to host django app on pythonanywhere for free”

  1. Just wish to say your article is as surprising. The clearness in your post
    is simply cool and i can assume you’re an expert on this subject.
    Well with your permission allow me to grab your RSS feed to keep up to date with forthcoming post.
    Thanks a million and please carry on the gratifying work.

  2. I’m not that much of a online reader to be honest but your blogs really nice, keep it up! I’ll go ahead and bookmark your website to come back later. Cheers

Leave a Reply

Your email address will not be published. Required fields are marked *