'I'm try to deploy my django project in Heroku by use Heroku CLI I face installation error
Everything goes right till I run this command:
git push heroku master
I get this massages:
git push heroku master
Enumerating objects: 55, done.
Counting objects: 100% (55/55), done.
Delta compression using up to 8 threads
Compressing objects: 100% (46/46), done.
Writing objects: 100% (55/55), 15.40 KiB | 685.00 KiB/s, done.
Total 55 (delta 14), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote: ! Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
remote: Detected buildpacks: Python,Node.js
remote: See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
remote: -----> Python app detected
remote: -----> No Python version was specified. Using the buildpack default: python-3.10.
remote: To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> Installing python-3.10.4
remote: -----> Installing pip 22.0.4, setuptools 60.10.0 and wheel 0.37.1
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote: Collecting argcomplete==1.8.1
remote: Downloading argcomplete-1.8.1-py2.py3-none-any.whl (34 kB)
remote: Collecting argh==0.26.2
remote: Downloading argh-0.26.2-py2.py3-none-any.whl (30 kB)
remote: Collecting attrs==19.3.0
remote: Downloading attrs-19.3.0-py2.py3-none-any.whl (39 kB)
remote: Collecting Automat==0.8.0
remote: Downloading Automat-0.8.0-py2.py3-none-any.whl (31 kB)
remote: Collecting blessings==1.6
remote: Downloading blessings-1.6.tar.gz (19 kB)
remote: Preparing metadata (setup.py): started
remote: Preparing metadata (setup.py): finished with status 'error'
remote: error: subprocess-exited-with-error
remote:
remote: × python setup.py egg_info did not run successfully.
remote: │ exit code: 1
remote: ╰─> [1 lines of output]
remote: error in blessings setup command: use_2to3 is invalid.
remote: [end of output]
remote:
remote: note: This error originates from a subprocess, and is likely not a problem with pip.
remote: error: metadata-generation-failed
remote:
remote: × Encountered error while generating package metadata.
remote: ╰─> See above for output.
remote:
remote: note: This is an issue with the package mentioned above, not pip.
remote: hint: See above for details.
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to murmuring-badlands-28149.
remote:
To https://git.heroku.com/murmuring-badlands-28149.git
! [remote rejected] master -> master (pre-receive hook declined)
settings.py file:
import os
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
# BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
TEMPLATES_DIR = os.path.join(BASE_DIR, 'templates')
STATIC_DIR = os.path.join(BASE_DIR, 'static')
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'pk5^b0zrhl+*h*8$=$fs(kq1nw(2)&j^$$e2gjk#64=5yrun4x'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ['weather-mahmood1.herokuapp.com', '127.0.0.1']
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'weather_app',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'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',
]
ROOT_URLCONF = 'weather_pro.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [TEMPLATES_DIR],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'weather_pro.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR,'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_ROOT = os.path.join(BASE_DIR,'staticfiles')
STATIC_URL = '/static/'
STATICFILES_DIRS = [STATIC_DIR]
I use windows 10 and I run this code from Ubuntu subsystem 20.04
Solution 1:[1]
You probably need to upgrade your blessings library to 1.7.
https://github.com/erikrose/blessings
From their release notes:
1.7:
Drop support for Python 2.6 and 3.3, which are end-of-lifed.
Switch from 2to3 to the six library.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Tadej Krevh |