Cookiecutter-django: Unable to use Login System in Production

Created on 20 Jun 2017  路  9Comments  路  Source: pydanny/cookiecutter-django

While I'm able to login to both the admin site and my own site login system while using dev configuration, I receive a 500 error every time I attempt to log in while using production config. Every time, I receive this exception:

`Exception Type: NoReverseMatch at /admin/login/

Exception Value: Reverse for 'home' with arguments '()' and keyword argumen=
ts '{}' not found. 0 pattern(s) tried: []
`

buin-production

Most helpful comment

Does your URL start with https? Because if it doesn't, you will have problems in production.

All 9 comments

There is a .env fill that you are to set up from the env.example that is in the project. There is one setting, DJANGO_ADMIN_URL= that you are to put in to access the admin panel.

At the bottom of the config.settings.production file, you can see the instructions on what else you can do.

I have ensured that I set the admin URL, and I can access the project_site/admin login page, but the authentication flow never finishes- I go to log in, and once I do, then I receive the 500 error.

Some questions:

  • How are you deploying? Docker? Elastic Beanstalk? Heroku? Python Anywhere?
  • Which version of Python?
  • Is production on HTTPS? (HTTP will break)
  • Are there any customizations you may have made that might break URLs?
  • I am deploying with Docker, using Python 3.5.3
  • How do I know if I'm using HTTPS? That might be an issue, I'm not sure.
  • The only problem I can think of is my home app URL, which is mapped to the site index

Does your URL start with https? Because if it doesn't, you will have problems in production.

It does not, but it does not load when trying to use https

Django and especially Cookiecutter Django are designed to break if run as http in production. We purposefully do this because it's a security issue.

Figure out why the site isn't loading as https. Once that's addressed, your current problem will mostly likely go away.

@pcodes has the issue been resolved?

Yes, I had my settings misconfigured. Thanks for the help!

Was this page helpful?
0 / 5 - 0 ratings