Forums

How do I change the URL configuration of my existing Django web app?

Is there a straightforward way for me to change the current URL of my Django web app (www.example.com) to another one (www.example2.com)? I've configured example2.com's CNAME record already to point at username.pythonanywhere.com, and have included '.example2.com' in Django settings of the existing Django project. www.example.com is now live and running well.

Question also asked on Stackoverflow:

SO Link

Alright I fixed this by dumbing down and manually starting a new django project and copying the files over, since it wasn't that large of a project. Still, would appreciate a better way to fix this the next time it happens :)

Hi guanxun, sorry for the slow reply. Here are the official docs on pointing a new domain to an existing web app. I'll post it to Stack Overflow too.

Oh wow I missed that, thank you for the link!

Seems similar to what I did actually, but instead of manual config I set the new project up as a Django app and then copied all the files over. Taking care to change the folder/project name in settings.py and where there were imports and stuff like that.

Glad I didn't end up doing too much extra work then...

Well, I'm glad you worked out a way to do it! If you happen to remember how you tried to find that page, let me know -- it would be good to update the page, add keywords, etc., so that other people looking for it have a good chance of getting to it. The plus of the way documented there is that it allows you to use exactly the same codebase for both web apps, which might be an advantage (or not if, say, you want to keep separate "dev" and "production" codebases).

"pythonanywhere change url of existing app" was the search term used in Google, and oddly enough, the #1 hit returned was Creating a new Django project on PythonAnywhere. Other links that showed up in Google didn't seem relevant.

Well, my Stackoverflow question and this post on the Forums are #1 and #3 (for me at least) now so that should help? Or maybe the title of the wiki page needs spaces, I dunno.

Yup, I'm seeing that on Google too, even on an incognito window. Hopefully that will bump up the Google-juice for the official docs too...

hello , i get a warning sign-- Warning: No virtualenv detected at this path. Do you need to create it? I know what i did wrong ( I think ) i believe when i was in manual configuration i selected python 3:9 but my wrapper is in 3:10. If i can just get back to the maula configuration page that would be awesome . If not how can I put my mind to rest to see if that is the problem.

You've just entered a path to a virtualenv that does not exist. You can try entering a path that does exist, or delete the web app and re-create it to get back to the manual configuration wizard.