I like to use the authentication machinery in Django, without explicitly 
putting 'django.contrib.auth' in INSTALLED_APPS. This prevents a bunch of 
unused tables from being creating in the database.

This was possible in earlier version of Django. In 1.8, a spurious warning 
was generated, but that was fixed in #24564 
(https://groups.google.com/forum/#!searchin/django-developers/$2324564/django-developers/7b4xzkjLFH8/wLJ83Bxa_h4J)

In Django 1.9, it doesn't seem possible anymore (see traceback). Using the 
auth stuff without installing the app -- is that something we want to 
support or not?

Traceback (most recent call last):
  File "/usr/lib/python3.4/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File 
"/home/example.com/.venv-bee4e82373367b8524982d09c561f7f1/lib/python3.4/site-packages/django/contrib/staticfiles/handlers.py",
 
line 63, in __call__
    return self.application(environ, start_response)
  File 
"/home/example.com/.venv-bee4e82373367b8524982d09c561f7f1/lib/python3.4/site-packages/django/core/handlers/wsgi.py",
 
line 158, in __call__
    self.load_middleware()
  File 
"/home/example.com/.venv-bee4e82373367b8524982d09c561f7f1/lib/python3.4/site-packages/django/core/handlers/base.py",
 
line 51, in load_middleware
    mw_class = import_string(middleware_path)
  File 
"/home/example.com/.venv-bee4e82373367b8524982d09c561f7f1/lib/python3.4/site-packages/django/utils/module_loading.py",
 
line 20, in import_string
    module = import_module(module_path)
  File "/usr/lib/python3.4/importlib/__init__.py", line 109, in 
import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2231, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2214, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2203, in 
_find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1448, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in 
_call_with_frames_removed
  File 
"/home/example.com/.venv-bee4e82373367b8524982d09c561f7f1/lib/python3.4/site-packages/django/contrib/auth/middleware.py",
 
line 3, in <module>
    from django.contrib.auth.backends import RemoteUserBackend
  File 
"/home/example.com/.venv-bee4e82373367b8524982d09c561f7f1/lib/python3.4/site-packages/django/contrib/auth/backends.py",
 
line 4, in <module>
    from django.contrib.auth.models import Permission
  File 
"/home/example.com/.venv-bee4e82373367b8524982d09c561f7f1/lib/python3.4/site-packages/django/contrib/auth/models.py",
 
line 38, in <module>
    class Permission(models.Model):
  File 
"/home/example.com/.venv-bee4e82373367b8524982d09c561f7f1/lib/python3.4/site-packages/django/db/models/base.py",
 
line 102, in __new__
    "INSTALLED_APPS." % (module, name)
RuntimeError: Model class django.contrib.auth.models.Permission doesn't 
declare an explicit app_label and isn't in an application in INSTALLED_APPS.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/839b75d4-c32a-404e-b991-0315804f095b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to