I'm new, and I'm having an issue switching to my Django 1.9 database to Postgres. Having made the switch, all my unit tests pass just fine, and the site works exactly the way I want it to when I run it locally. However, my Selenium tests all fail at the login stage. It's odd--if I follow the steps of the Selenium tests, it works just fine.
Here are the Selenium tests on pastebin <http://pastebin.com/u5VQcUY2>. When I use the sqlite database (settings <http://pastebin.com/5mvxzNLF>), all these tests pass. When I set postgres up and switched to it (django settings <http://pastebin.com/cMJkP7ag>, pg_hba.conf <http://pastebin.com/axKbssNg>) The test_whether_login_works_with_django_client test passes. The test_whether_login_page_works test fails with this traceback <http://pastebin.com/JjAV7c9E>. What happens is that the Selenium browser sends the login info to the login page, and gets redirected to the login page. Here are some things I've ruled out: 1) The login credentials are correct. This is checked in two places. The log_user_in helper function in the Selenium tests tests the credentials directly using django.contrib.auth.authenticate on line 45 and following of the Selenium tests <http://pastebin.com/u5VQcUY2>. In addition, the test_whether_login_works_with_django_test_client tests the credentials directly by sending them to the login view and testing whether the user is authenticated. 2) Django is able to write to and read from the postgres database. The unit tests I've set up for this pass, plus I can manually create users, login, save items, and retrieve items from the database using manage.py's runserver feature. 3) The problem is not with the login view, at least directly. If I switch back to the sqlite database, these tests pass just fine. (I've switched the settings back and forth several times.) Plus, I've manually tested the login page with my browser. 4) The problem doesn't result from an attempt to migrate data from the old sqlite database. I just set up the postgres database, ran makemigrations and migrate, and started with a brand new database. I'm pretty stumped. I've got Selenium up to date with pip. I'm using python 3.4. I posted on Stack Overflow, but nobody can figure it out. Thanks! -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4a6c1395-e50a-4d9d-8b19-51cbdd93965d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.