2

Friends -

I have a django app (build with cookiecutter) and I have it deployed on Heroku, following these steps here:

https://cookiecutter-django.readthedocs.io/en/latest/deployment-on-heroku.html

Everything works fine and I can also create instances in the database. Now, when I try to enter the admin-page with /admin I get an 404 Page not found error.

When deploying I had this error: (which I ignored)

remote:        Invalid input of type: 'CacheKey'. Convert to a byte, string or number first.
remote:        --> Continuing using default collectstatic.

I ignored this error because I everything was working. Now, could that be connected or am I just missing something here?

I assume I after deployment I should be able to login to the django admin section, or am I mistaken? I set my admin url in my .env file, but still, I get this problem. Locally everything runs perfectly....

Any help or hints are very much appreciated!

Micromegas
  • 1,499
  • 2
  • 20
  • 49
  • I found the solution. I had to specify this in Heroku. heroku config:set DJANGO_ADMIN_URL=heregoesyouradminlinkasspecifiedinyourenvfile/ – Micromegas Apr 17 '19 at 17:57
  • That solution didn't work for me. My DJANGO_ADMIN_URL shown after typing "heroku config" now matches my DJANGO_ADMIN_URL shown in .envs/.production/.django, but it didn't work. The 404 message in the heroku logs when going to the admin/ page is ``` 2019-07-06T23:09:47.425279+00:00 heroku[router]: at=info method=GET path="/admin" host=intense-bayou-60635.herokuapp.com request_id=f6df675b-e8bc-4104-975c-8275d2537b45 fwd="73.90.6.166" dyno=web.1 connect=1ms service=521ms status=404 bytes=6402 protocol=https ``` – Joe Silverstein Jul 07 '19 at 04:46
  • 2
    it looks like you set your django admin url to /admin/. Is that what you specify in your ./envs/.production/.django? You have to follow the link that you set in your envs (and in production I'd recommend **not** using /admin/). – Micromegas Jul 07 '19 at 10:08
  • Nvm I figured it out. I didn't realize that the random combination of characters in the DJANGO_ADMIN_URL field was supposed to be the actual URL rather than an encrypted version of it. I went to the actual URL shown in the DJANGO_ADMIN_URL field and it worked. – Joe Silverstein Jul 07 '19 at 19:52
  • yes that's what I meant. Glad you made it work – Micromegas Jul 07 '19 at 19:54

0 Answers0