Deploy Python project in heroku with error

0

I am trying to deploy a Python project using Django in Heroku. The deploy all goes well, but when trying to heroku run python manage.py migrate the following error occurs.

Traceback (most recent call last):
File "manage.py", line 23, in <module>
  execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
  utility.execute()
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 317, in execute
  settings.INSTALLED_APPS
File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 56, in __getattr__
  self._setup(name)
File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 43, in _setup
  self._wrapped = Settings(settings_module)
File "/app/.heroku/python/lib/python3.6/site-packages/django/conf/__init__.py", line 106, in __init__
  mod = importlib.import_module(self.SETTINGS_MODULE)
File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
  return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/app/djangosige/configs/__init__.py", line 3, in <module>
  from .settings import *
File "/app/djangosige/configs/settings.py", line 4, in <module>
  from .configs import DEFAULT_DATABASE_URL, DEFAULT_FROM_EMAIL, EMAIL_HOST, EMAIL_HOST_USER, EMAIL_HOST_PASSWORD, EMAIL_PORT, EMAIL_USE_TLS
ModuleNotFoundError: No module named 'djangosige.configs.configs'

This is my configs.py file

# Configuração da base de dados

# Caso seja deixado vazio o default será: 'sqlite:////...djangosige/db.sqlite3'
DEFAULT_DATABASE_URL = 'postgres://meuuser:minhasenhadbc@localhost/nomebd'

# Configurações do servidor de email

# Endereço de email padrão utilizado

DEFAULT_FROM_EMAIL = '[email protected]'

EMAIL_HOST = 'smtp.gmail.com'  # Gmail
# EMAIL_HOST = 'smtp.live.com' #Hotmail

# Usuário do email padrão
EMAIL_HOST_USER = 'meuuser'

# Senha do email padrão
EMAIL_HOST_PASSWORD = 'minhasenha'

# Verificar a port utilizada pelo serviço de email
EMAIL_PORT = 587

EMAIL_USE_TLS = True

Does anyone know what might be happening?

    
asked by anonymous 14.12.2018 / 02:07

1 answer

0

Interpreting the error message:

You have the module:

/app/djangosige/configs/__init__.py

In line 3 of this file you make an import

from .settings import *

It is executed successfully, with the asterisk you import everything implicitly, a practice not recommended by PEP 20 (Explicit is better than implicit.), in this import the file settings.py is loaded and in your line 4 you do import:

from .configs import DEFAULT_DATABASE_URL, DEFAULT_FROM_EMAIL,....

That is, you are in /app/djangosige/configs/ doing import of the config module that does not exist. So the error message: No module named 'djangosige.configs.configs'

    
14.12.2018 / 14:16