Heroku does not recognize my Django app

Asked

Viewed 108 times

-1

I’m starting my studies with Django and created an application called core within the name Django project django1. After finishing, I decided to deploy it to Heroku with the following step by step (with a git repository already started):

heroku login
heroku create nome-do-app --buildpack heroku/python
heroku git:remote -a nome-do-app
heroku config:set ALLOWED_HOSTS=(link do projeto)
DJANGO_SETTINGS_MODULE=django1.settings.heroku
SECRET_KEY=blablabla
DEBUG=False

Everything happened normally and the project was deployed, however Heroku simply cannot identify my app core on the list of INSTALLED_APPS of my project (even though she was there):

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'core', # tambem tentei o core.apps.CoreConfig
]

I realized that Heroku was not recognizing because at the time of the migrations, while Django recognizes all the installed apps, Heroku recognizes only the ones that come as standard from Jango:

Heroku não reconhece app "core"

Already deleted the app from Heroku and tried the same process a few times, but the same thing always happens: Heroku deploys the app but can’t "find" the app core to carry out the migrations.

Here are some prints that may be relevant: (base.py is the default Settings.py that Django generates. With this change, I’ve also made the necessary edits to the python asgi.py, wsgi.py, Manage.py, and base.py files myself.)

Project structure:

Estrutura do projeto

Structure of the app core:

Estrutura da app core

Heroku.py file:

Heroku.py

Procfile:

release: python3 manage.py migrate
web: gunicorn django1.wsgi --preload --log-file -

How should I proceed?

  • 1

    In INSTALLED_APPS instead of using core, use nome_do_projeto.core

  • @Paulomarques I just tried here, still don’t recognize :/

1 answer

0


I managed to solve.

What explains the project app being recognized locally but not in Heroku is that, although I didn’t make it explicit in the question, my file .gitignore was set to ignore all files __init__.py. For this reason, briefly, Heroku "ignored" the folder migration files core/migrations. So, to solve the problem, I just deleted this restriction from the file and Heroku recognized the app and ran the migrations normally.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.