python - Django: Twitter login being redirected to Example Domain -
i'm using django-socialregistration
enabling users login using twitter account on application.
settings.py
installed_apps = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rango', 'django.contrib.sites', 'socialregistration', 'socialregistration.contrib.twitter' ) ... ... template_context_processors = ('django.contrib.auth.context_processors.auth', 'django.core.context_processors.debug', 'django.core.context_processors.i18n', 'django.core.context_processors.media', 'django.core.context_processors.static', 'django.contrib.messages.context_processors.messages', 'django.core.context_processors.request',) authentication_backends = ( 'django.contrib.auth.backends.modelbackend', 'socialregistration.contrib.twitter.auth.twitterauth', ) twitter_consumer_key = 'xxxxxxxxxxxxxxxxxx' twitter_consumer_secret_key = 'xxxxxxxxxxxxxxxxxxxx' site_id = 1 session_serializer='django.contrib.sessions.serializers.pickleserializer'
urls.py
from django.conf.urls import patterns, include, url django.contrib import admin urlpatterns = patterns('', # examples: # url(r'^$', 'getevangelized.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^rango/', include('rango.urls')), url(r'^social/', include('socialregistration.urls', namespace = 'socialregistration')))
template
<body> <h1>microcelebrity form</h1><br> {% load twitter %} {% twitter_button %} <br> <form id="evangelized_form" method="post" action="/rango/fillform/"> {% csrf_token %} {% hidden in form.hidden_fields %} {{ hidden }} {% endfor %} {% field in form.visible_fields %} {{ field.errors }} <b>{{ field.help_text }}</b><br> {{ field }}<br><br> {% endfor %} <input type="submit" name="submit" value="submit" /> </form> </body>
however, on clicking on twitter signup button, redirected this:
the url of webpage follows:
http://example.com/social/twitter/callback/?oauth_token=_wtpxwaaaaaagtieaaabtim7zye&oauth_verifier=thezd4ypshncyei6mpwivkugirkz20yh
the settings of twitter application follows:
callback url http://127.0.0.1:8000/auth/twitter/callback sign in twitter yes app-only authentication https://api.twitter.com/oauth2/token request token url https://api.twitter.com/oauth/request_token authorize url https://api.twitter.com/oauth/authorize access token url https://api.twitter.com/oauth/access_token website http://www.cloudclovis.com callback url http://127.0.0.1:8000/auth/twitter/callback
what 'example domain' webpage signify? when click on 'more information' link on page, i'm redirected http://www.iana.org/domains/reserved
what mean? , how can allow users login using twitter accounts in application?
its redirecting there because default sites
framework has example.com
default site.
you need change 127.0.0.1:8000
if in development mode.
to change it, can use default admin interface, or use django shell:
from django.contrib.sites.models import site site = site.objects.get(pk=1) site.domain = '127.0.0.1:8000' site.save()
Comments
Post a Comment