django browserid ImproperlyConfigured at /browserid/login/

146 Views Asked by At

I am trying out django-browserid==0.9 with django 1.6, and after configuring the app as per the docs for 0.9 and signing the user in, I get:

ImproperlyConfigured at /browserid/login/
request `http://127.0.0.1:8000`, was not found in SITE_URL `['http://localhost:8000']`

The stacktrace seems to lead to:

/local/lib/python2.7/site-packages/django_browserid/views.py in dispatch
def dispatch(self, request, *args, **kwargs):
    """Run some sanity checks on the request prior to dispatching it."""
    sanity_checks(request)
    return super(Verify, self).dispatch(request, *args, **kwargs)

I have the following setup (browserid related):

#settings.py
LOGIN_REDIRECT_URL = '/thanks'
LOGIN_REDIRECT_URL_FAILURE = '/'
LOGOUT_REDIRECT_URL = '/'
SITE_URL = 'http://localhost:8000'
BROWSERID_CREATE_USER = True
def username(email):
    return email.rsplit('@', 1)[0]
BROWSERID_USERNAME_ALGO = username

#views.py
class HomeTemplateView(TemplateView):
    template_name = "base.html"
class ThanksTemplateView(TemplateView):
    template_name = "thanks.html"

#urls.py
urlpatterns = patterns('',
    url(r'^$', HomeTemplateView.as_view(), name='home'),
    url(r'^thanks/$', ThanksTemplateView.as_view(), name='thanks'),
    url(r'^browserid/', include('django_browserid.urls')),
    url(r'^admin/', include(admin.site.urls)),
)

I would greatly appreciate if anyone could point me in the right direction to solve this issue (or maybe I am doing something stupid here!).

Many thanks.

1

There are 1 best solutions below

1
JohnJ On

I found the fix - I think I was pretty stupid on this - the error message was self explanatory:

Change SITE_URL localhost to http://127.0.0.1:8000

problem solved. apologies to whoever read the problem!