Not using correct database for new site in DNS-based multitenancy setup

Hello Frappe Community,

I have been setting up ERPNext with DNS-based multitenancy according to the official documentation. However, I’m encountering an issue where the new site I created (site1.example.com) is still using the database of the default site instead of its own database. Here are the steps I’ve followed:

  1. I have created a new site which is the default site(site1.example.com)

  2. bench config dns_multitenant on To turn on the Multi Tenancy

  3. bench new-site site2.example.com Created another site now

  4. bench setup nginx

  5. sudo service nginx reload

  6. I have added this site to the /etc/hosts

Despite these steps, when accessing site1.example.com, ERPNext continues to use the database of the default site.

Could someone please help me troubleshoot this issue? Are there any additional steps or configurations I might be missing to ensure ERPNext uses the correct database for each site in a DNS-based multitenancy setup?

Thanks in advance!

Hmm, I’m not sure about the following solutions:

  • Remove the sites/currentsite.txt file
  • Confirm that both sites have different db_name in sites/<name>/site_config.json.
2 Likes

Hi @balajib.cc:

Check if you really are in the supposed site …

In javascript console use:
frappe.boot.sitename

Probably there is some dns or multitenancy config issue …
Hope this helps.

Thanks for responding @corentin

I have removed the currentsite and its working. The issue now is newly created sites are loading fine with their respective databases but default site is not loading. Why is that so? Could you explaing why default site is not loading? Thanks again @corentin