15

I tried to follow the latest http://django-allauth.readthedocs.org/en/latest/#installation

urls.py file looks like:

urlpatterns = patterns('',
    url(r'^admin/', include(admin.site.urls)),
    url(r'^accounts/', include('allauth.urls')),
)

settings.py file has:

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
)

TEMPLATE_CONTEXT_PROCESSORS = (
    # Required by allauth template tags
    "django.core.context_processors.request",
    "django.contrib.auth.context_processors.auth",
    # allauth specific context processors
    "allauth.account.context_processors.account",
    "allauth.socialaccount.context_processors.socialaccount",
)

AUTHENTICATION_BACKENDS = (
    # Needed to login by username in Django admin, regardless of `allauth`
    "django.contrib.auth.backends.ModelBackend",
    # `allauth` specific authentication methods, such as login by e-mail
    "allauth.account.auth_backends.AuthenticationBackend",
)
SITE_ID = 1

and i ran python manage.py syncdb but when i visit my localhost:8000/accounts/login/, it gives me Page Not Found (404). I also double checked what I did with a tutorial at: http://www.sarahhagstrom.com/2013/09/the-missing-django-allauth-tutorial/ but I'm not sure what else to do to get a basic login screen to show up. Any pointers?

EDIT

here's the error on the page in addition to the Page Not Found 404

Using the URLconf defined in asa.urls, Django tried these URL patterns, in this order:
^admin/
^accounts/ ^ ^signup/$ [name='account_signup']
^accounts/ ^ ^login/$ [name='account_login']
^accounts/ ^ ^logout/$ [name='account_logout']
^accounts/ ^ ^password/change/$ [name='account_change_password']
^accounts/ ^ ^password/set/$ [name='account_set_password']
^accounts/ ^ ^inactive/$ [name='account_inactive']
^accounts/ ^ ^email/$ [name='account_email']
^accounts/ ^ ^confirm-email/$ [name='account_email_verification_sent']
^accounts/ ^ ^confirm-email/(?P<key>\w+)/$ [name='account_confirm_email']
^accounts/ ^ ^confirm_email/(?P<key>\w+)/$
^accounts/ ^ ^password/reset/$ [name='account_reset_password']
^accounts/ ^ ^password/reset/done/$ [name='account_reset_password_done']
^accounts/ ^ ^password/reset/key/(?P<uidb36>[0-9A-Za-z]+)-(?P<key>.+)/$ [name='account_reset_password_from_key']
^accounts/ ^ ^password/reset/key/done/$ [name='account_reset_password_from_key_done']
^accounts/ ^social/

The current URL, accounts/profile/, didn't match any of these.

guettli
  • 25,042
  • 81
  • 346
  • 663
newbieProgrammer
  • 227
  • 2
  • 10

1 Answers1

21

Just to check: have you started your server?

python manage.py runserver

EDIT:

It looks like you're trying accounts/profile/, which isn't a registered URL. Does it still give an error if you go to localhost:8000/accounts/register?

Also, from the docs:

When I attempt to login I run into a 404 on /accounts/profile/

When you end up here you have successfully logged in. However, you will need to implement a view for this URL yourself, as whatever is to be displayed here is project specific. You can also decide to redirect elsewhere.

Looks like you need to write your own view for accounts/profile/

If you want, you can set your login redirect to a different page in settings.py. I.e.:

LOGIN_REDIRECT_URL = "/"

This would send you back to your homepage.

Community
  • 1
  • 1
Alex
  • 8,321
  • 1
  • 34
  • 30
  • haha yea, I have started it. I could see in the /admin section that tables were created for Sites and Socialaccount – newbieProgrammer Apr 08 '14 at 18:53
  • Can you post the more specifics on the error you received? – Alex Apr 08 '14 at 18:56
  • i just updated the post with the error which appears to say it included the urls from allauth.urls – newbieProgrammer Apr 08 '14 at 19:01
  • 1
    Ok, see my new edit. I'm guessing you're already logged in, so it redirects you to your LOGIN_REDIRECT_URL (default in django is accounts/profile. You'll need to either (1) change it in your settings, or (2) add a url and view for accounts/profile/. Let me know if that makes sense. – Alex Apr 08 '14 at 19:15
  • No problem. Keep at it. It just takes practice. – Alex Apr 08 '14 at 19:30
  • 1
    I'm really glad to have seen this. I was just starting with AllAuth. To do so, I had to log into admin and set up an app profile. Then the first thing that I did was try to test it using accounts/login and it redirected to profile, which didn't exist. It was disorienting to be directed to a page I hadn't specified that didn't exist, and it was difficult to tell that it was because AllAuth was seeing that I was already logged in. After seeing this comment I just went to admin and logged out and BAM! Everything worked. Pretty neat. – Doug Bradshaw Jan 17 '16 at 02:25