0

While running heroku logs --tail I see

enter image description here

Failed to find attribute 'application' in 'django'

Why am I getting this error?

My deployment was successful when I pushed my code to heroku master and it was deployed but I am getting this error. I added requirements.txt and ProcFile correctly. Its working perfectly in local host.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
Surya_1897
  • 97
  • 9
  • [Please don't post screenshots of text](https://meta.stackoverflow.com/a/285557/354577). They can't be searched or copied and offer poor usability. Instead, paste the code as text directly into your question. If you select it and click the `{}` button or Ctrl+K the code block will be indented by four spaces, which will cause it to be rendered as code. – ChrisGPT was on strike Aug 03 '20 at 12:29
  • Was the issue that you named your Procfile incorrectly? It should be named Procfile and not ProcFile. – Olney1 Sep 20 '22 at 19:27

2 Answers2

2

i have same issue for my settings gunicorn config is wrong config for django, from :

web: gunicorn inventory:wsgi

resolve this to :

web: gunicorn inventory.wsgi:application

inventory is example name your folder projectname for called file wsgi.py inside the folder, example structure folder on startproject django-admin:

[projectname]/
├── [projectname]/
│   ├── __init__.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py -> here
└── manage.py

and application is object inside wsgi.py file, example:

"""
WSGI config for inventory project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'inventory.settings')

application = get_wsgi_application() #--> this object

p.s: sorry for my bad english

Eki Saputra
  • 177
  • 1
  • 7
1

You appear to be trying to run a file that was copied in Windows and has spaces in its name. Either quote or escape the spaces in your Procfile:

gunicorn "django - Copy.wsgi"

or, better yet, fix the name of that file, change your Procfile accordingly, commit, and redeploy.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257