Django-registration - how do I change example.com in an email?

I have django registration setup and it sends emails - yay!

However, he decided that it would be easy to name my site “example.com”, which is not the name that I decided to use. Cool name, but not for me.

How to change example.com to something else? I read somewhere that I go to the admin page, but - a spoiler alert - I never used the admin page in django and do not plan to actively plan it now (but maybe someday?)

So, I go to the /admin/sites/site/ page - /admin/sites/site/ - and I'm sure I see "example.com" and "domain name". But what now? I added the domain name of my site and the "display name", but how to choose it to use it? I even deleted example.com!

However, the letter insists on sending example.com. All the sites that I read just say “use admin”, but I don’t know, maybe my administrator is broken (which would be strange, since I really didn’t touch it), or if there is a link that I don’t see?

Any ideas?

+6
source share
2 answers

The entry that you saw initially on the admin/sites/site/ page, with example.com and domain name , is the one you should simply edit for the fastest results (instead of adding a new site object).

What is really going on?

In your settings file, Django automatically defines the SITE_ID property SITE_ID you create your project, which is set to 1 by default. This points to example.com , which you see in the admin. If you want to use the created Site object or change the site objects later when you need this function, you can change this SITE_ID property to the identifier of the created Site object. Hope this helps!

+10
source

The site object in the template comes from the Django site model. When you synchronize, example.com is automatically assigned by default

If you enter the Django admin interface, you will find "Sites". Inside, you can change example.com to whatever you want. Just set the site id u you want to use as the current site in settings.py as SITE_ID = ID . for example, if you change the domain name example.com to mysite.com and display it as MYSITE . then SITE_ID = 1 , because this is the only content that we have in our Sites table, and its ID is 1 . if you want to add other details to the "Sites", leaving example.com intact, do not forget to set SITE_ID in the ID one added

enter image description here

+2
source

Source: https://habr.com/ru/post/919918/


All Articles