Setting up a custom domain on PythonAnywhere

If you have a paid account on PythonAnywhere, you can set up web apps on your own domain -- that is, a domain that is not your-username.pythonanywhere.com

Configuring the domain at the domain registrar

To use your own domain name with a PythonAnywhere web app there are two steps

  1. Purchase a domain name from a domain name registry.

  2. Create a CNAME record for (say) www.yourdomain.com pointing to the value specified on the "Web" tab for your application; this will be of the form webapp-XXXX.pythonanywhere.com. This tells the domain name system that when someone asks for your website, they should get it from us.

Domains without a www prefix (naked domains)

One small problem with setting up DNS like this is that it doesn't allow "naked domains" -- that is, you can have your site at www.yourdomain.com or somethingelse.yourdomain.com, but not at just yourdomain.com. Here's some more information about that, and some recommendations.

General Instructions

CNAME records have two parts. The Alias and the Canonical Name. The alias in this case should be www. The address should be the value from the "Web" tab.

Different DNS providers call them different things. So:

Testing your configuration

CNAME changes can take a little while to propagate from your registrar to the rest of the Internet. You can see whether the change has reached PythonAnywhere yet by looking at the app on the web tab; it will show a warning if the CNAME it sees for your domain is not the one it expects. You can also use this CNAME lookup tool if you want to get a second opinion -- enter your web app's name (including the "www") and select "CNAME" from the dropdown. It will check the CNAME from a bunch of different places around the Internet, which will give you a feel for how far the setup has got.

If your CNAME is still not working after a couple of hours, you should double-check your setup.

Specific DNS providers

Associating a PythonAnywhere web app with your domain

If you want to create a new web app associated with the domain, just click the "Add a new web app" button on the Web tab, and specify the domain on the first page.

If you want your domain to show a web app that you've already created, the process is a little more complicated. Let's say that the app you want to show is currently displayed at fred.pythonanywhere.com, and you want it to appear at www.yourdomain.com. Once you've done the CNAME setup as described above, here's what you do:

That should do the job.

OwnDomains (last edited 2015-07-10 09:04:25 by giles)