Forums

Using a Custom Domain bought from Google Domains

Hello!

I'm trying to get my basic website working at a custom domain I bought off of Google Domains. After following the instructions I found here, and set up a CNAME for www to redirect to my webapp-xxxxx.pythonanywhere.com address. According to whatsmydns.com, the CNAME has already propagated to the pythonanywhere.com address globally.

My question then is, why am I getting a 404 error on trying to visit the site? Before I'd gone through all of this, I'd tried to do the same thing using Google Domains "forward website to x address" feature, and I at least got the Python Anywhere This Site is Under Construction page. Now I don't even get that, and the app's page in my dashboard still tells me that my CNAME is ghs.googlehosted.com, even though that's directly contradicted by whatsmydns.com, as you can see above.

My apologies if this is a dumb or obvious question, but any help would be greatly appreciated.

Hi kpowell, you were doing the right thing when you had the CNAME configured, so you should switch back to that. the "forward website" feature won't work.

If you're getting a 404, that's actually good news. Our infrastructure won't generate 404s, only 502s and 504s, so the 404 was coming from your code. Figuring out why is another story...

Thanks for your response!

I can see how CNAME vs forwarding stuff was confusingly worded. I switched off of the "forward website" feature before posting here - whatever is happening now is due to the CNAME stuff.

In any case - I'm now seeing 502s and 504s. Pressing the "Reload site" button tells me that "a problem has occurred", and going to my site now gives me the PythonAnywhere "something went wrong error page". The thing is, that error page is now taking ages to load. I'm confused because my site is incredibly simple (It's just rendering a template in flask and serving up a single image), and on my local environment seems to be working fine. Indeed, when in run the app via the PythonAnywhere console, it appears to be running locally there too as one would expect.

Edit: I should also add that the error and sever logs for my site are blank - though the access logs do show all my attempts to access the site. It looks like the CNAME stuff is finally working.

Any ideas what might be going on, or should I open another thread/send another email?

Thanks again!

A common problem with Flask is that you shouldn't use app.run() -- have you seen this from our help pages?

http://help.pythonanywhere.com/pages/Flask504Error

http://help.pythonanywhere.com/pages/Flask

I had not! That's almost certainly the problem.

One last silly question. If my app logic is located in app.py, then that import statement ought to be something like

from app import app as application

Correct?

Edit: Looks like that is correct - the site is now up and running. Thanks for the help!

:)