0

I'm having difficulty moving my django 1.9.3 app from local development to production on Heroku, specifically using allauth (0.25.2) to login via Twitter.

It appears I'm having the same problem as django allauth not working on production yet that answer does not work for me.

When I'm running the dev server, everything works with the callback url on twitter set to http://127.0.0.1:8000/accounts/twitter/login/callback/.

When I switch it to either http://{myappname}.herokuapp.com/accounts/twitter/login/callback/ or http://{myappname}.herokuapp.com/accounts/twitter/login/callback/ and access the app on Heroku, I get a 500 error when I try to login via Twitter, being redirected to https://{myappname}.herokuapp.com/accounts/twitter/login/?process=login

I'm including the following settings in settings.py, which I've tried toggling during my troubleshooting:

ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
ACCOUNT_EMAIL_SUBJECT_PREFIX = "[{myappname}] "
ACCOUNT_LOGIN_ATTEMPTS_LIMIT = {number}
ACCOUNT_LOGIN_ATTEMPTS_TIMEOUT = {number}
ACCOUNT_LOGIN_ON_EMAIL_CONFIRMATION = False
ACCOUNT_LOGOUT_ON_PASSWORD_CHANGE = True
ACCOUNT_LOGOUT_REDIRECT_URL = "/"
SOCIALACCOUNT_EMAIL_REQUIRED = ACCOUNT_EMAIL_REQUIRED

And for production (again, have tried toggling these):

SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_BROWSER_XSS_FILTER = True
SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
CSRF_COOKIE_HTTPONLY = True
X_FRAME_OPTIONS = 'DENY'

I've also tried refreshing the auth keys. Any ideas of what I'm doing wrong?

Community
  • 1
  • 1
jsamsf
  • 435
  • 7
  • 17
  • When ever you are asking question about an internal server error, you need to add the full error trace to your question – e4c5 Jul 05 '16 at 02:28
  • Unfortunately, I'm not seeing any error trace coming up in my terminal window. – jsamsf Jul 05 '16 at 02:37
  • it wont be in your terminal window. it will be in your logs. or run with debug=True and get it in the browser – e4c5 Jul 05 '16 at 02:39

2 Answers2

1

Taking e4c5's suggestion, I turned on debug in the production environment. This quickly lead to this question: Django: SocialApp matching query does not exist and the problem being with my SITE_ID configuration.

jsamsf
  • 435
  • 7
  • 17
1

Late to the party here but you can try running a migration on Heroku.

heroku run python manage.py migrate
  • From Review: Hi, this post does not seem to provide a [quality answer](https://stackoverflow.com/help/how-to-answer) to the question. Please either edit your answer and improve it, or just post it as a comment. – sɐunıɔןɐqɐp Nov 13 '19 at 11:47