Setting up a custom domain on PythonAnywhere

If you have a Web Developer or a Custom plan 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 your-username.pythonanywhere.com. This tells the domain name system that when someone asks for your website, they should get it from us. All of your domains should point to the same target, your-username.pythonanywhere.com, we'll take care of showing the right web app on the right domain.

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 your-username.pythonanywhere.com.

Different DNS providers call them different things. So:

Testing your configuration

Use this CNAME lookup tool. Enter your domain name including the www. It will take a few seconds. In the results, if the Canonical Name is anything other than your-username.pythonanywhere.com or it doesn't even show you a result for Canonical Name then you have either not set it up properly. Or you need to wait longer for the configuration changes to take effect.

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-02-18 11:02:24 by harry)