Django Modelo: ValueError: falta la entrada de manifiesto de archivos estáticos para "file_name.ext"
Antes de marcarlo como duplicado, he leídoValueError: falta la entrada de manifiesto de archivos estáticos para 'favicon.ico', y no resuelve mi problema.
Tengo el siguiente modelo:
from django.contrib.staticfiles.templatetags.staticfiles import static
class Profile(models.Model):
user = models.ForeignKey(SocialUser, on_delete=models.PROTECT)
avatar_url = models.URLField(
default=static('pledges/images/no-profile-photo.png'))
Estoy usando Codeship para CI, y cuando ejecuto:
$ python manage.py collectstatic --noinput
Estoy teniendo el siguiente error
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/home/rof/.pyenv/versions/3.6/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/home/rof/.pyenv/versions/3.6/lib/python3.6/site-packages/django/core/management/__init__.py", line 338, in execute
django.setup()
File "/home/rof/.pyenv/versions/3.6/lib/python3.6/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/rof/.pyenv/versions/3.6/lib/python3.6/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models()
File "/home/rof/.pyenv/versions/3.6/lib/python3.6/site-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/home/rof/.pyenv/versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/rof/src/github.com/company-name/project-name/pledges/models.py", line 106, in <module>
class Profile(models.Model):
File "/home/rof/src/github.com/company-name/project-name/pledges/models.py", line 109, in Profile
default=static('pledges/images/no-profile-photo.png'))
File "/home/rof/.pyenv/versions/3.6/lib/python3.6/site-packages/django/contrib/staticfiles/templatetags/staticfiles.py", line 12, in static
return _static(path)
File "/home/rof/.pyenv/versions/3.6/lib/python3.6/site-packages/django/templatetags/static.py", line 166, in static
return StaticNode.handle_simple(path)
File "/home/rof/.pyenv/versions/3.6/lib/python3.6/site-packages/django/templatetags/static.py", line 117, in handle_simple
return staticfiles_storage.url(path)
File "/home/rof/.pyenv/versions/3.6/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 162, in url
return self._url(self.stored_name, name, force)
File "/home/rof/.pyenv/versions/3.6/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 141, in _url
hashed_name = hashed_name_func(*args)
File "/home/rof/.pyenv/versions/3.6/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 432, in stored_name
raise ValueError("Missing staticfiles manifest entry for '%s'" % clean_name)
ValueError: Missing staticfiles manifest entry for 'pledges/images/no-profile-photo.png'
No tengo problemas a nivel local, así que me pregunto qué está causando este problema y cómo solucionarlo. Lo que entiendo del código es que no puedo usar la funciónstatic
para un campo modelo.
¿Alguien tiene alguna idea de cómo resolver esto? ¿Alguien puede explicarme por qué sucede esto?