我正在尝试按照Heroku的建议通过WhiteNoise提供静态文件.当我在我的开发环境中运行时,会发生这种情况:collectstatic
Post-processing 'css/iconic/open-iconic-bootstrap.css' failed!
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/Pieter/.virtualenvs/radiant/lib/python3.4/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/home/Pieter/.virtualenvs/radiant/lib/python3.4/site-packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/Pieter/.virtualenvs/radiant/lib/python3.4/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/Pieter/.virtualenvs/radiant/lib/python3.4/site-packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/home/Pieter/.virtualenvs/radiant/lib/python3.4/site-packages/django/core/management/base.py", line 533, in handle
return self.handle_noargs(**options)
File "/home/Pieter/.virtualenvs/radiant/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 168, in handle_noargs
collected = self.collect()
File "/home/Pieter/.virtualenvs/radiant/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 120, in collect
raise processed
File "/home/Pieter/.virtualenvs/radiant/lib/python3.4/site-packages/django/contrib/staticfiles/storage.py", …Run Code Online (Sandbox Code Playgroud) 我正在尝试从 Django 1.9.7 迁移到 Django 1.11.5。我有三个不同的 django 应用程序,它们在包和设置方面几乎相同。我已经将它们三个都部署到了一个网络服务器上,两个应用程序都可以正常运行,但第三个让我很头疼——我一直收到这个错误:
ValueError at / Missing staticfiles manifest entry for ''
Run Code Online (Sandbox Code Playgroud)
以下是最相关的设置settings.py:
# -*- coding: utf-8 -*-
from settings import *
SECRET_KEY = '***'
SITE_ID = 3
ALLOWED_HOSTS = [
'localhost',
'127.0.0.1',
'.example.com',
'.example.com.',
]
INSTALLED_APPS += (
'storages',
'example',
'example2',
'el_pagination',
'debug_toolbar',
)
ROOT_URLCONF = 'example.urls'
WSGI_APPLICATION = 'example.wsgi.application'
DEFAULT_FROM_EMAIL = 'web@example.com'
MANAGERS = ADMINS
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
'DEFAULT_MIDDLEWARE_ALIAS': 'default',
'DEFAULT_MIDDLEWARE_SECONDS': '300',
'DEFAULT_MIDDLEWARE_KEY_PREFIX': '',
} …Run Code Online (Sandbox Code Playgroud) 在将其标记为重复之前,我已阅读ValueError: Missing staticfiles manifest entry for 'favicon.ico' ,但它并没有解决我的问题。
我有以下模型:
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'))
Run Code Online (Sandbox Code Playgroud)
我正在使用 Codeship for CI,当我运行时:
$ python manage.py collectstatic --noinput
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
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 …Run Code Online (Sandbox Code Playgroud)