Helloo!
I’ve developed an app which works fine in the local machine. But when deployed to Heroku, I only see a page displaying “Internal Server Error”. I’ve made sure that the secret key is correct and all the database credentials (which is stored in a .env file and ignored by .gitignore) are correct.
I’ve also migrated the database to Heroku and I do have a Heroku adds-on.
Could someone please check my logs and explain what I am doing wrong?
You can visit the page at: https://abbasportfolio.herokuapp.com/ and see the error.
I’ve been struggling for about a week now. All help is appreciated!
My heroku logs shows:
2023-03-29T19:30:55.007523+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/django/views/debug.py", line 366, in get_traceback_data
2023-03-29T19:30:55.007523+00:00 app[web.1]: "settings": self.filter.get_safe_settings(),
2023-03-29T19:30:55.007524+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-03-29T19:30:55.007524+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/django/views/debug.py", line 150, in get_safe_settings
2023-03-29T19:30:55.007524+00:00 app[web.1]: settings_dict[k] = self.cleanse_setting(k, getattr(settings, k))
2023-03-29T19:30:55.007524+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^
2023-03-29T19:30:55.007525+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/django/conf/__init__.py", line 101, in __getattr__
2023-03-29T19:30:55.007525+00:00 app[web.1]: raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
2023-03-29T19:30:55.007525+00:00 app[web.1]: django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
2023-03-29T19:30:55.007526+00:00 app[web.1]:
2023-03-29T19:30:55.007526+00:00 app[web.1]: During handling of the above exception, another exception occurred:
2023-03-29T19:30:55.007526+00:00 app[web.1]:
2023-03-29T19:30:55.007526+00:00 app[web.1]: Traceback (most recent call last):
2023-03-29T19:30:55.007527+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/django/core/handlers/exception.py", line 56, in inner
2023-03-29T19:30:55.007527+00:00 app[web.1]: response = get_response(request)
2023-03-29T19:30:55.007527+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^^
2023-03-29T19:30:55.007527+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/whitenoise/middleware.py", line 124, in __call__
2023-03-29T19:30:55.007528+00:00 app[web.1]: return self.get_response(request)
2023-03-29T19:30:55.007528+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-03-29T19:30:55.007528+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/django/core/handlers/exception.py", line 58, in inner
2023-03-29T19:30:55.007529+00:00 app[web.1]: response = response_for_exception(request, exc)
2023-03-29T19:30:55.007531+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=abbasportfolio.herokuapp.com request_id=65c8ae13-144f-417c-a310-5573ebebe220 fwd="77.218.38.169" dyno=web.1 connect=0ms service=563ms status=500 bytes=244 protocol=https
2023-03-29T19:30:55.007531+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-03-29T19:30:55.007531+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/django/core/handlers/exception.py", line 144, in response_for_exception
2023-03-29T19:30:55.007532+00:00 app[web.1]: log_response(
2023-03-29T19:30:55.007532+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/django/utils/log.py", line 241, in log_response
2023-03-29T19:30:55.007532+00:00 app[web.1]: getattr(logger, level)(
2023-03-29T19:30:55.007532+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/logging/__init__.py", line 1518, in error
2023-03-29T19:30:55.007533+00:00 app[web.1]: self._log(ERROR, msg, args, **kwargs)
2023-03-29T19:30:55.007533+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/logging/__init__.py", line 1634, in _log
2023-03-29T19:30:55.007533+00:00 app[web.1]: self.handle(record)
2023-03-29T19:30:55.007534+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/logging/__init__.py", line 1644, in handle
2023-03-29T19:30:55.007534+00:00 app[web.1]: self.callHandlers(record)
2023-03-29T19:30:55.007534+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/logging/__init__.py", line 1706, in callHandlers
2023-03-29T19:30:55.007535+00:00 app[web.1]: hdlr.handle(record)
2023-03-29T19:30:55.007535+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/logging/__init__.py", line 978, in handle
2023-03-29T19:30:55.007535+00:00 app[web.1]: self.emit(record)
2023-03-29T19:30:55.007535+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/django/utils/log.py", line 125, in emit
2023-03-29T19:30:55.007536+00:00 app[web.1]: reporter.get_traceback_text(),
2023-03-29T19:30:55.007536+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-03-29T19:30:55.007537+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/django/views/debug.py", line 403, in get_traceback_text
2023-03-29T19:30:55.007537+00:00 app[web.1]: c = Context(self.get_traceback_data(), autoescape=False, use_l10n=False)
2023-03-29T19:30:55.007537+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^^^^^^
2023-03-29T19:30:55.007538+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/django/views/debug.py", line 366, in get_traceback_data
2023-03-29T19:30:55.007538+00:00 app[web.1]: "settings": self.filter.get_safe_settings(),
2023-03-29T19:30:55.007538+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-03-29T19:30:55.007538+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/django/views/debug.py", line 150, in get_safe_settings
2023-03-29T19:30:55.007539+00:00 app[web.1]: settings_dict[k] = self.cleanse_setting(k, getattr(settings, k))
2023-03-29T19:30:55.007539+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^
2023-03-29T19:30:55.007539+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/django/conf/__init__.py", line 101, in __getattr__
2023-03-29T19:30:55.007539+00:00 app[web.1]: raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
2023-03-29T19:30:55.007540+00:00 app[web.1]: django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
2023-03-29T19:30:55.007540+00:00 app[web.1]:
2023-03-29T19:30:55.007540+00:00 app[web.1]: During handling of the above exception, another exception occurred:
2023-03-29T19:30:55.007540+00:00 app[web.1]:
2023-03-29T19:30:55.007540+00:00 app[web.1]: Traceback (most recent call last):
2023-03-29T19:30:55.007541+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 136, in handle
2023-03-29T19:30:55.007541+00:00 app[web.1]: self.handle_request(listener, req, client, addr)
2023-03-29T19:30:55.007541+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 179, in handle_request
2023-03-29T19:30:55.007541+00:00 app[web.1]: respiter = self.wsgi(environ, resp.start_response)
2023-03-29T19:30:55.007541+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-03-29T19:30:55.007542+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/django/core/handlers/wsgi.py", line 131, in __call__
2023-03-29T19:30:55.007542+00:00 app[web.1]: response = self.get_response(request)
2023-03-29T19:30:55.007542+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-03-29T19:30:55.007542+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/django/core/handlers/base.py", line 140, in get_response
2023-03-29T19:30:55.007543+00:00 app[web.1]: response = self._middleware_chain(request)
2023-03-29T19:30:55.007543+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-03-29T19:30:55.007543+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/django/core/handlers/exception.py", line 58, in inner
2023-03-29T19:30:55.007543+00:00 app[web.1]: response = response_for_exception(request, exc)
2023-03-29T19:30:55.007544+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-03-29T19:30:55.007544+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/django/core/handlers/exception.py", line 144, in response_for_exception
2023-03-29T19:30:55.007544+00:00 app[web.1]: log_response(
2023-03-29T19:30:55.007544+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/django/utils/log.py", line 241, in log_response
2023-03-29T19:30:55.007545+00:00 app[web.1]: getattr(logger, level)(
2023-03-29T19:30:55.007545+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/logging/__init__.py", line 1518, in error
2023-03-29T19:30:55.007545+00:00 app[web.1]: self._log(ERROR, msg, args, **kwargs)
2023-03-29T19:30:55.007545+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/logging/__init__.py", line 1634, in _log
2023-03-29T19:30:55.007546+00:00 app[web.1]: self.handle(record)
2023-03-29T19:30:55.007546+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/logging/__init__.py", line 1644, in handle
2023-03-29T19:30:55.007546+00:00 app[web.1]: self.callHandlers(record)
2023-03-29T19:30:55.007546+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/logging/__init__.py", line 1706, in callHandlers
2023-03-29T19:30:55.007547+00:00 app[web.1]: hdlr.handle(record)
2023-03-29T19:30:55.007547+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/logging/__init__.py", line 978, in handle
2023-03-29T19:30:55.007547+00:00 app[web.1]: self.emit(record)
2023-03-29T19:30:55.007548+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/django/utils/log.py", line 125, in emit
2023-03-29T19:30:55.007550+00:00 app[web.1]: reporter.get_traceback_text(),
2023-03-29T19:30:55.007551+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-03-29T19:30:55.007551+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/django/views/debug.py", line 403, in get_traceback_text
2023-03-29T19:30:55.007551+00:00 app[web.1]: c = Context(self.get_traceback_data(), autoescape=False, use_l10n=False)
2023-03-29T19:30:55.007552+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^^^^^^
2023-03-29T19:30:55.007552+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/django/views/debug.py", line 366, in get_traceback_data
2023-03-29T19:30:55.007552+00:00 app[web.1]: "settings": self.filter.get_safe_settings(),
2023-03-29T19:30:55.007558+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-03-29T19:30:55.007558+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/django/views/debug.py", line 150, in get_safe_settings
2023-03-29T19:30:55.007559+00:00 app[web.1]: settings_dict[k] = self.cleanse_setting(k, getattr(settings, k))
2023-03-29T19:30:55.007559+00:00 app[web.1]: ^^^^^^^^^^^^^^^^^^^^
2023-03-29T19:30:55.007559+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.11/site-packages/django/conf/__init__.py", line 101, in __getattr__
2023-03-29T19:30:55.007560+00:00 app[web.1]: raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
2023-03-29T19:30:55.007560+00:00 app[web.1]: django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
2023-03-29T19:30:55.007672+00:00 app[web.1]: 10.1.89.102 - - [29/Mar/2023:19:30:55 +0000] "GET /favicon.ico HTTP/1.1" 500 0 "-" "-"