0

So I'm trying to deploy my website in heroku. It gets deployed successfully but when i open the site, it displays application error. When I ran the logs, it displayed no module name mylife.wsgi. Here is the full error that I got.

Starting process with command `gunicorn mylife.wsgi --log-file -`
Process exited with status 3
State changed from starting to crashed.

Also

__import__(module)
ModuleNotFoundError: No module named 'mylife.wsgi'

I tried changing wsgi file, even added middleware, but no luck.

Here is my wsgi.py file

import os

from django.core.wsgi import get_wsgi_application

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

application = get_wsgi_application()

Here is my middleware from settings.py

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',

]

Here is my Procfile

web: gunicorn mylife.wsgi --log-file -

Here is my requirements.txt

Django==2.0
dj-database-url==0.5.0
dj-static==0.0.6
gunicorn==19.9.0
Pillow==3.3.0
psycopg2-binary==2.7.7
whitenoise==4.1.2
django_ckeditor

Here is the file structure

└───mylife
    ├───accounts
    │   ├───migrations
    │   │   └───__pycache__
    │   ├───templates
    │   │   └───accounts
    │   └───__pycache__
    ├───daily
    │   ├───migrations
    │   │   └───__pycache__
    │   ├───static
    │   │   ├───css
    │   │   └───js
    │   ├───templates
    │   │   └───daily
    │   └───__pycache__
    ├───mylife
    │   └───__pycache__
    └───staticfiles
        ├───admin
        │   ├───css
        │   │   └───vendor
        │   │       └───select2
        │   ├───fonts
        │   ├───img
        │   │   └───gis
        │   └───js
        │       ├───admin
        │       └───vendor
        │           ├───jquery
        │           ├───select2
        │           │   └───i18n
        │           └───xregexp
        └───js

So can you guys please help me what I'm doing wrong.

Bibek Bhandari
  • 422
  • 1
  • 4
  • 15

1 Answers1

0

My Procfile was not detected beacuse of my file structure. So I modified the Procfile as

--pythonpath mylife

This solved the issue.

Bibek Bhandari
  • 422
  • 1
  • 4
  • 15