0
I’m trying to deploy a Python project using Django on Heroku. deploy is fine, but when trying to make Heroku run python Manage.py migrate the following error occurs.
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'
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
My 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',
Can anyone help me with this mistake? Thanks in advance
there was a comment (as an answer) on my answer in which you affirmed already created the
requirements.txt
with thepip freeze
, ok, but make sure you’re sending that file to Heroku, it needs to be under that name:requirements.txt
– Sidon