Forums

Problem with custom domain

Hi. I have a Django code and when i build up a web app in web tab using the domain with .pythonanywhere included, everything just work fine. But when i use the same project in a web app with custom domain (without .pythonanywhere) and try to enter the website using the custom domain it just show me a page with the title Coming Soon! and a help link that contains nothing helpful in my case.

Is there anything special about custom domains? Should i do anything more than what i did for .pythonanywhere included domain in custom domain settings?

P.S: I'm using Cloudflare as a nameserver layer.

Have you set up the DNS on CloudFlare? When I check the DNS settings for your custom domain using What's my DNS I don't see an A record or a CNAME for it.

There's some information on setting up DNS here and we've also got a blog post on CloudFlare specifically.

Is that how i should do that on CloudFlare ?
enter image description here

P.S: when i try to access my custom domain it conduct me to a page of PythonAnywhere, doesn't that mean the DNS stuff is working correctly?

Ah, I think I see the problem.

The website you've set up on PythonAnywhere is "www.szamani.ir". The setup you've done on CloudFlare is for "szamani.ir", without the www. If you change the CloudFlare setup to use the "www" then it should all work fine. (Just for clarity -- you only put "www" in the text box in the CloudFlare interface -- the ".szamani.ir" is implicit.)

If you also want the version without the "www" to go to your website, then check out the blog post I linked to before -- it has instructions on how to do that. (If the instructions are unclear, please do let me know -- we've just updated the post, so things may still need improvement.)

I've changed things and now my web app has the custom domain of szamani.ir and it just works fine. Now how i should set up CloudFlare to redirect www.szamani.ir to szamani.ir ?
Is that the correct way? (It didn't work till now)
enter image description here

P.S: About the blog posts on PythonAnywhere, it would be way better if you include more pictures and screenshots also for those who may not fully understand English.
Thanks!

That looks right, but I'm not an expert on CloudFlare. What you're trying to do is the opposite of what we normally suggest (have the version without the "www" redirect to the version with it), so hopefully you just need to reverse the instructions -- set up a Page Rule to forward www.szamani.ir/* to szamani.ir/$1.