Estou tentando fazer deploy de um projeto Python usando Django no Heroku. O deploy ocorre tudo bem, mas ao tentar fazer heroku run python manage.py migrate ocorre o seguinte erro.
Traceback (most recent call last): File "manage.py", line 23, in 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 "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/app/djangosige/configs/init.py", line 3, in from .settings import * File "/app/djangosige/configs/settings.py", line 4, in 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 'mjsolutions.configs.configs'
Esse é meu arquivo configs.py
# 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
Meu settings.py
import os
from decouple import config, Csv
from dj_database_url import parse as dburl
from .configs import DEFAULT_DATABASE_URL, DEFAULT_FROM_EMAIL, EMAIL_HOST, EMAIL_HOST_USER, EMAIL_HOST_PASSWORD, EMAIL_PORT, EMAIL_USE_TLS
APP_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
PROJECT_ROOT = os.path.abspath(os.path.dirname(APP_ROOT))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = config('SECRET_KEY')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = config('DEBUG', default=False, cast=bool)
ALLOWED_HOSTS = config('ALLOWED_HOSTS', default=[], cast=Csv())
if not DEFAULT_DATABASE_URL:
DEFAULT_DATABASE_URL = 'sqlite:///' + os.path.join(APP_ROOT, 'db.sqlite3')
DATABASES = {
'default': config('DATABASE_URL', default=DEFAULT_DATABASE_URL, cast=dburl),
}
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
Alguem poderia me ajudar com este erro? Obrigado desde já
requirements.txt
com opip freeze
, ok, mas tenha certeza de que vc esta enviando esse arquivo para o Heroku, precisa ser com esse nome:requirements.txt