Setting up a custom domain on PythonAnywhere

If you have a paid account on PythonAnywhere, you can set up websites on a custom domain -- that is, a domain that is not

There are three steps

  1. (if you haven't already), purchase a domain name from a domain name registrar.
  2. Create a new entry on the Web tab for your new domain
  3. Create a CNAME record with your domain provider, pointing at the new website

There's are two optional, but recommended steps, to make your site secure. Do these after you've done the steps above:

  1. Set up an HTTPS/SSL certificate
  2. Force HTTPS on your website

Purchasing a domain name

We don't recommend any particular domain registrar, they're all pretty similar. Just google around, compare prices (they should all be very similar), and pick the one that seems to have the friendliest user interface.

Creating a PythonAnywhere website for your new domain

For best performance and reliability on PythonAnywhere, we strongly recommend that you use a CNAME to point your domain at our servers. Without going too much into the technical details, a CNAME means that you don't need to do any DNS configuration beyond the initial setup; we can manage everything for you, so if (for example) the IP address associated with your website gets blocked in some country, or if it's subjected to a denial-of-service attack, we can move your website over to a different IP address without you needing to do anything.

The one restriction that CNAMEs have is that they cannot be used for "naked" or "apex" domains. To make that more concrete, you can use or for the website, but not But that doesn't have to be a problem; you can host your site on and then set things up so that people who visit are automatically redirected to There's more information on that last bit later on.

Given all that, here's how to create the website:

If you don't have a website for it yet

Just click the "Add a new web app" button on the Web tab. In the first step, it will ask you for the domain name to use. You should specify the fully-qualified domain name -- that is,, not just Next go on to choose your Python version, framework and so on.

If you already have a website that you want to use

This help page explains how to use a new domain for existing website, for example if the site you want to show is currently displayed at, and you want it to appear at Once again, you should specify the fully-qualified domain name -- that is, rather than

Configuring the domain at the domain registrar

Once you've purchased your domain and created the new website config on PythonAnywhere, you'll want to find the configuration screen on your domain provider that allows you to set up a CNAME record.

The CNAME record will point to the value specified on the "Web" tab for your application; this value will be of the form where XXXX is some number or other. Setting up this kind of record tells the domain name system that when someone asks for your website, they should get it from one of the servers that make up PythonAnywhere.

Note: your website itself will not show up at the address. It's just an identifier for a server.

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 -- the one like

Different DNS providers call them different things.

  • Alias: domain name, Alias name, or just "name"
  • Canonical Name: the address, FQDN, Fully Qualified Domain Name, or Host Name.

If you're using OVH as your registrar, you may also see that they've automatically created a TXT record for with a value of "3|welcome" -- you'll need to delete that, as a domain can't have both a TXT record and a CNAME.

Notes for specific DNS providers

Here's how to set up a CNAME for some popular registrars:

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 site on the "Web" page; 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 website's name (including the www. prefix) 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 propagation has got.

If your CNAME is still not working after a couple of hours, you should double-check your setup. If you can't work out what is wrong, email us at, including a screenshot of the settings as you have configured them on your registrar's DNS setup page.

There are two steps to do for this:

  1. Set up an HTTPS/SSL certificate for your domain
  2. Force HTTPS on your website

Optional: Set up a naked domain redirect

Most people want their site set up so that when someone goes to they are redirected to, or if they go to they are redirected to, and so on.

The easiest way to do this is normally to set it up with your domain provider; almost all of them provide it as a free service. Here are the links for some popular registrars:

If you are using a different registrar, searching for "forward naked domain" plus the name of your registrar will probably find the appropriate help page.

If your registrar doesn't support domain redirects, we know of two alternatives, both free: