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

SITE_ID should not be a required setting. #328

Closed
Raam124 opened this issue Sep 17, 2020 · 2 comments
Closed

SITE_ID should not be a required setting. #328

Raam124 opened this issue Sep 17, 2020 · 2 comments

Comments

@Raam124
Copy link

Raam124 commented Sep 17, 2020

Django no longer includes SITE_ID in the default settings.py and no longer adds django.contrib.sites to INSTALLED_APPS

Exception in thread django-main-thread: Traceback (most recent call last): File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "/usr/lib/python3.8/threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "/home/raam/.local/lib/python3.8/site-packages/django/utils/autoreload.py", line 53, in wrapper fn(*args, **kwargs) File "/home/raam/.local/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 118, in inner_run self.check(display_num_errors=True) File "/home/raam/.local/lib/python3.8/site-packages/django/core/management/base.py", line 392, in check all_issues = checks.run_checks( File "/home/raam/.local/lib/python3.8/site-packages/django/core/checks/registry.py", line 70, in run_checks new_errors = check(app_configs=app_configs, databases=databases) File "/home/raam/.local/lib/python3.8/site-packages/django/core/checks/urls.py", line 13, in check_url_config return check_resolver(resolver) File "/home/raam/.local/lib/python3.8/site-packages/django/core/checks/urls.py", line 23, in check_resolver return check_method() File "/home/raam/.local/lib/python3.8/site-packages/django/urls/resolvers.py", line 408, in check for pattern in self.url_patterns: File "/home/raam/.local/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/home/raam/.local/lib/python3.8/site-packages/django/urls/resolvers.py", line 589, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/home/raam/.local/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/home/raam/.local/lib/python3.8/site-packages/django/urls/resolvers.py", line 582, in urlconf_module return import_module(self.urlconf_name) File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 783, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/home/raam/Documents/project4/newsletterTest/urls.py", line 24, in <module> url(r'^newsletter/', include('newsletter.urls')), File "/home/raam/.local/lib/python3.8/site-packages/django/urls/conf.py", line 34, in include urlconf_module = import_module(urlconf_module) File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 783, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/home/raam/.local/lib/python3.8/site-packages/newsletter/urls.py", line 3, in <module> from .views import ( File "/home/raam/.local/lib/python3.8/site-packages/newsletter/views.py", line 50, in <module> class NewsletterViewBase(object): File "/home/raam/.local/lib/python3.8/site-packages/newsletter/views.py", line 52, in NewsletterViewBase queryset = Newsletter.on_site.filter(visible=True) File "/home/raam/.local/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/home/raam/.local/lib/python3.8/site-packages/django/contrib/sites/managers.py", line 60, in get_queryset return super().get_queryset().filter(**{self._get_field_name() + '__id': settings.SITE_ID}) File "/home/raam/.local/lib/python3.8/site-packages/django/conf/__init__.py", line 84, in __getattr__ val = getattr(self._wrapped, name) AttributeError: 'Settings' object has no attribute 'SITE_ID'

@dokterbob
Copy link
Collaborator

I agree. Hardly anyone is using this stuff.

I'm 100% for making it optional. PR's to this extent are greatly welcomed.

@dokterbob
Copy link
Collaborator

Dup of #238

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

2 participants