#css #django #heroku #collectstatic
Вопрос:
Я пытаюсь это сделать, но не получил никакого решения .. Я сказал, что постобработка «staticfilesstaticcssstyle.css» не удалась! но в моем файле нет никаких проблем . Мой этот проект работает на компьютере без каких-либо ошибок, вы можете проверить мое репо здесь https://github.com/programmer-Quazi/personal-blog.git
Это мой вывод терминала после выполнения этой команды
python manage.py соберите статику
Post-processing 'staticfilesstaticcssstyle.css' failed!
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:UsersfaaldAppDataRoamingPythonPython38site-packagesdjangocoremanagement__init__.py", line 419, in execute_from_command_line
utility.execute()
File "C:UsersfaaldAppDataRoamingPythonPython38site-packagesdjangocoremanagement__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:UsersfaaldAppDataRoamingPythonPython38site-packagesdjangocoremanagementbase.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "C:UsersfaaldAppDataRoamingPythonPython38site-packagesdjangocoremanagementbase.py", line 398, in execute
output = self.handle(*args, **options)
File "C:UsersfaaldAppDataRoamingPythonPython38site-packagesdjangocontribstaticfilesmanagementcommandscollectstatic.py", line 187, in handle
collected = self.collect()
File "C:UsersfaaldAppDataRoamingPythonPython38site-packagesdjangocontribstaticfilesmanagementcommandscollectstatic.py", line 134, in collect
raise processed
whitenoise.storage.MissingFileError: The file 'staticfiles/static/img/elements/primary-check.png' could not be found with <whitenoise.storage.CompressedManifestStaticFilesStorage object at 0x000001F9F6FF3280>.
The CSS file 'staticfilesstaticcssstyle.css' references a file which could not be found:
staticfiles/static/img/elements/primary-check.png
Please check the URL references in this CSS file, particularly any
relative paths which might be pointing to the wrong location.
мой settigns.py файл является
"""
Django settings for djangoProject4 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 django_heroku
import dj_database_url
import os
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# 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-bdytm3$mnq xpi3pa*l=^n9^56gsq7amp;kga0)h=p#77#9t$t!rl'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'blog',
'storages',
'taggit',
# 'django_quill'
]
INSTALLED_APPS = ('django_summernote',)
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'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 = 'djangoProject4.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [ 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',
],
},
},
]
WSGI_APPLICATION = 'djangoProject4.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 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 = [BASE_DIR, 'static']
STATIC_ROOT = BASE_DIR, 'static_root'
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'media/'
AWS_ACCESS_KEY_ID = 'AKIARVGPJVYVssLNFAAMTG'
AWS_SECRET_ACCESS_KEY = 'KiHvGcSD4xWB1si/WocUwoflFQJAt3x0UJss9kuDDz'
AWS_STORAGE_BUCKET_NAME = 'naassim.secpspstorage'
AWS_S3_FILE_OVERWRITE = False
# AWS_QUERYSTRING_AUTH = False
AWS_DEFAULT_ACL = None
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
X_FRAME_OPTIONS= 'SAMEORIGIN'
django_heroku.settings(locals())