I was going to deploy my app on heroku. I have set all of the paths such as STATIC_ROOT
, STATIC_URL
and STATICFILES_DIRS
correctly. I am still getting the error.
Anyone knows whats wrong?
Traceback error
remote: Traceback (most recent call last):
remote: File "/tmp/build_64cf714d/manage.py", line 22, in <module>
remote: main()
remote: File "/tmp/build_64cf714d/manage.py", line 18, in main
remote: execute_from_command_line(sys.argv)
remote: File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
remote: utility.execute()
remote: File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute
remote: self.fetch_command(subcommand).run_from_argv(self.argv)
remote: File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
remote: self.execute(*args, **cmd_options)
remote: File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
remote: output = self.handle(*args, **options)
remote: File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 187, in handle
remote: collected = self.collect()
remote: File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 128, in collect
remote: for original_path, processed_path, processed in processor:
remote: File "/app/.heroku/python/lib/python3.9/site-packages/whitenoise/storage.py", line 148, in post_process_with_compression
remote: for name, hashed_name, processed in files:
remote: File "/app/.heroku/python/lib/python3.9/site-packages/whitenoise/storage.py", line 88, in post_process
remote: for name, hashed_name, processed in files:
remote: File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/staticfiles/storage.py", line 399, in post_process
remote: yield from super().post_process(*args, **kwargs)
remote: File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/staticfiles/storage.py", line 231, in post_process
remote: for name, hashed_name, processed, _ in self._post_process(paths, adjustable_paths, hashed_files):
remote: File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/staticfiles/storage.py", line 288, in _post_process
remote: content = pattern.sub(converter, content)
remote: File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/staticfiles/storage.py", line 187, in converter
remote: hashed_url = self._url(
remote: File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/staticfiles/storage.py", line 126, in _url
remote: hashed_name = hashed_name_func(*args)
remote: File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/staticfiles/storage.py", line 338, in _stored_name
remote: cache_name = self.clean_name(self.hashed_name(name))
remote: File "/app/.heroku/python/lib/python3.9/site-packages/whitenoise/storage.py", line 166, in hashed_name
remote: name = super(CompressedManifestStaticFilesStorage, self).hashed_name(
remote: File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/staticfiles/storage.py", line 87, in hashed_name
remote: if not self.exists(filename):
remote: File "/app/.heroku/python/lib/python3.9/site-packages/django/core/files/storage.py", line 318, in exists
remote: return os.path.exists(self.path(name))
remote: File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/staticfiles/storage.py", line 41, in path
remote: return super().path(name)
remote: File "/app/.heroku/python/lib/python3.9/site-packages/django/core/files/storage.py", line 331, in path
remote: return safe_join(self.location, name)
remote: File "/app/.heroku/python/lib/python3.9/site-packages/django/utils/_os.py", line 29, in safe_join
remote: raise SuspiciousFileOperation(
remote: django.core.exceptions.SuspiciousFileOperation: The joined path (/tmp/build_64cf714d/webfonts/fa-brands-400.eot) is located outside of the base path component (/tmp/build_64cf714d/staticfiles)
remote:
remote: ! Error while running '$ python manage.py collectstatic --noinput'.
remote: See traceback above for details.
remote:
remote: You may need to update application code to resolve this error.
remote: Or, you can disable collectstatic for this application:
remote:
remote: $ heroku config:set DISABLE_COLLECTSTATIC=1
remote:
remote: https://devcenter.heroku.com/articles/django-assets
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to iffi-store-app.
remote:
To https://git.heroku.com/iffi-store-app.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/iffi-store-app.git'
My settings.py
"""
Django settings for customise project.
Generated by 'django-admin startproject' using Django 3.2.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
import os
import django_heroku
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-)chu4r&scuyncwba^on1go*9!1=k+*ip4fgs@z2n8d6$%@xt+3'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'index',
'cart',
'crispy_forms',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
CRISPY_TEMPLATE_PACK = 'uni_form'
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 = 'customise.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, "templates")
],
'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',
'django.template.context_processors.media',
],
},
},
]
WSGI_APPLICATION = 'customise.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.2/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.2/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.2/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.2/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
]
# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
django_heroku.settings(locals())
Any help will surely be appreciated.