Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django 3.2 breaks django-multisite: The SITE_ID setting must be an integer #76

Open
digodude opened this issue Apr 6, 2021 · 7 comments

Comments

@digodude
Copy link

digodude commented Apr 6, 2021

After upgrading to Django 3.2 and using django-multisite 1.9.0 the development django runserver doesn't pass a new test:

ERRORS:
?: (sites.E101) The SITE_ID setting must be an integer

@erimeilis
Copy link

Yep, and if you use SITE_ID = int(SiteID(default=1)) instead, than you'll get:

env/lib/python3.9/site-packages/multisite/middleware.py", line 46, in init
raise TypeError('Invalid type for settings.SITE_ID: %s' %
TypeError: Invalid type for settings.SITE_ID: int

@pfouque
Copy link

pfouque commented Aug 20, 2021

Hi, i didn't tried yet but there is a fix for that issue in parent project : shestera@1ec217d

@erimeilis
Copy link

Hi, i didn't tried yet but there is a fix for that issue in parent project : shestera@1ec217d

Hello! It seems to eliminate problem with SITE_ID, but another one comes, - 404 for every site.

@marksweb
Copy link

Ah you found my fix! If that fix doesn't work for you (@erimeilis) or you'd rather stick to the main releases, you can also use a django setting which I'd forgotten about when patching this new check.

The django setting SILENCED_SYSTEM_CHECKS will avoid this problem.
https://docs.djangoproject.com/en/3.2/ref/settings/#std:setting-SILENCED_SYSTEM_CHECKS

@mellertson
Copy link

I undertstand using SILENCED_SYSTEM_CHECKS will quiet the error message. But, I'm just curious if another solution has been found for this issue?

@mellertson
Copy link

I found that doing SITE_ID = int(os.environ.get('SITE_ID', 1)) fixed the issue with Django version 4.2. Hope that helps someone.

@kotrotko
Copy link

mellertson It works for me, thank you))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants