[Answer]-Django – ImproperlyConfiguredError, Guardian's ANONYMOUS_USER_ID

1👍

I’ve just made myself sure that after following configuration instructions from http://packages.python.org/django-guardian/configuration.html project runs smoothly with guardian (using Django 1.4).

… and to answer your question:

  1. Try to avoid importing stuff inside settings module. If you do, make absolutely sure there are no circular imports issue. Actually, you have exactly that issue. If you need to, you can i.e. use *post_syncdb* signal: (https://docs.djangoproject.com/en/dev/ref/signals/#post-syncdb). In your case it shouldn’t be needed, though, as you’ve already stated that removing that import fixed problem with running command (so settings module hasn’t used assign shortcut anyway).

  2. ROOT_URLCONF attribute should definitely be set (it is if you generate project with Django’s build-in command (i.e. django-admin.py startproject myproject). If it’s missing, then yep, your configuration is broken. Try settings that attribute to something like 'myproject.urls' (or wherever your main urls are) and check if that fixes the problem.

0👍

For the record, I encountered the same issue with the last official release (installed with a simple pip install django-guardian)

This does not happen when you install the version from the lukaszb’s git repository, I double checked the source code

Leave a comment