I seem to be getting an issue with serving running collectstatic when whitenoise is enabled. I keep getting an error about a missing file - not quite sure why.
Here is the fill traceback
Post-processing 'third/vendors/owl-carousel/assets/owl.carousel.css' failed!
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/home/thegqvow/virtualenv/gradientboostmvp/3.7/lib/python3.7/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
utility.execute()
File "/home/thegqvow/virtualenv/gradientboostmvp/3.7/lib/python3.7/site-packages/django/core/management/__init__.py", line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/thegqvow/virtualenv/gradientboostmvp/3.7/lib/python3.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/thegqvow/virtualenv/gradientboostmvp/3.7/lib/python3.7/site-packages/django/core/management/base.py", line 335, in execute
output = self.handle(*args, **options)
File "/home/thegqvow/virtualenv/gradientboostmvp/3.7/lib/python3.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 189, in handle
collected = self.collect()
File "/home/thegqvow/virtualenv/gradientboostmvp/3.7/lib/python3.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 135, in collect
raise processed
File "/home/thegqvow/virtualenv/gradientboostmvp/3.7/lib/python3.7/site-packages/django/contrib/staticfiles/storage.py", line 296, in _post_process
content = pattern.sub(converter, content)
File "/home/thegqvow/virtualenv/gradientboostmvp/3.7/lib/python3.7/site-packages/django/contrib/staticfiles/storage.py", line 197, in converter
force=True, hashed_files=hashed_files,
File "/home/thegqvow/virtualenv/gradientboostmvp/3.7/lib/python3.7/site-packages/django/contrib/staticfiles/storage.py", line 134, in _url
hashed_name = hashed_name_func(*args)
File "/home/thegqvow/virtualenv/gradientboostmvp/3.7/lib/python3.7/site-packages/django/contrib/staticfiles/storage.py", line 345, in _stored_name
cache_name = self.clean_name(self.hashed_name(name))
File "/home/thegqvow/virtualenv/gradientboostmvp/3.7/lib/python3.7/site-packages/django/contrib/staticfiles/storage.py", line 94, in hashed_name
raise ValueError("The file '%s' could not be found with %r." % (filename, self))
ValueError: The file 'third/vendors/owl-carousel/assets/owl.video.play.png' could not be found with <django.contrib.staticfiles.storage.ManifestStaticFilesStorage object at 0x7f5018ab78d0>.
Related
When I deploy the project on herokou server, while migrating, I encountered this error. While in my system, there was no such error and the project was working properly
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, i
n execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/__init__.py", line 395, i
n execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/base.py", line 328, in ru
n_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/base.py", line 369, in ex
ecute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/base.py", line 83, in wra
pped
res = handle_func(*args, **kwargs)
File "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/commands/migrate.py", lin
e 86, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "/app/.heroku/python/lib/python3.7/site-packages/django/db/migrations/executor.py", line 18, in _
_init__
self.loader = MigrationLoader(self.connection)
File "/app/.heroku/python/lib/python3.7/site-packages/django/db/migrations/loader.py", line 49, in __i
nit__
self.build_graph()
File "/app/.heroku/python/lib/python3.7/site-packages/django/db/migrations/loader.py", line 274, in bu
ild_graph
raise exc
File "/app/.heroku/python/lib/python3.7/site-packages/django/db/migrations/loader.py", line 248, in bu
ild_graph
self.graph.validate_consistency()
File "/app/.heroku/python/lib/python3.7/site-packages/django/db/migrations/graph.py", line 195, in val
idate_consistency
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "/app/.heroku/python/lib/python3.7/site-packages/django/db/migrations/graph.py", line 195, in <li
stcomp>
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "/app/.heroku/python/lib/python3.7/site-packages/django/db/migrations/graph.py", line 58, in rais
e_error
raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration account.0001_initial dependencies reference
nonexistent parent node ('auth', '0013_auto_20200828_2241')
Where is the problem?
It says what the error is. You have an app called "account" and the migrations for this app is looking for migration 0013_auto_20200828_2241 in 'auth" which is one of django's main migrations.
This probably means in your requirements you are using a different version of django to your local. So your local has the migration and the one you are installing on heroku does not?
I'm trying to build a search engine into a django blog application and when I ran the command:
>>> manage.py build_solr_schema
I got this error:
Traceback (most recent call last):
File "C:\Users\KOLAPO\Google Drive\Python\Websites\mysite\manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\KOLAPO\Anaconda3\lib\site-packages\django\core\management\__init__.py", line 363, in execute_from_command_line
utility.execute()
File "C:\Users\KOLAPO\Anaconda3\lib\site-packages\django\core\management\__init__.py", line 355, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\KOLAPO\Anaconda3\lib\site-packages\django\core\management\base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\KOLAPO\Anaconda3\lib\site-packages\django\core\management\base.py", line 330, in execute
output = self.handle(*args, **options)
File "C:\Users\KOLAPO\Anaconda3\lib\site-packages\haystack\management\commands\build_solr_schema.py", line 29, in handle
schema_xml = self.build_template(using=using)
File "C:\Users\KOLAPO\Anaconda3\lib\site-packages\haystack\management\commands\build_solr_schema.py", line 57, in build_template
return t.render(c)
File "C:\Users\KOLAPO\Anaconda3\lib\site-packages\django\template\backends\django.py", line 64, in render
context = make_context(context, request, autoescape=self.backend.engine.autoescape)
File "C:\Users\KOLAPO\Anaconda3\lib\site-packages\django\template\context.py", line 287, in make_context
raise TypeError('context must be a dict rather than %s.' % context.__class__.__name__)
TypeError: context must be a dict rather than Context.
What's wrong?
Note: I'm using Solr and Django-haystack for the search engine
I think this issue has been fixed by pull request 1504, but it looks like there hasn't been a release since then.
I can't find the solution for an exception when I start my tests which suddenly accured while coding. The website still works fine with runserver. Here is the full traceback:
Traceback (most recent call last):
File "manage.py", line 10, in <module
execute_from_command_line(sys.argv)
File "…/lib/python3.5/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "…/lib/python3.5/site-packages/django/core/management/__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "…/lib/python3.5/site-packages/django/core/management/commands/test.py", line 29, in run_from_argv
super(Command, self).run_from_argv(argv)
File "…/lib/python3.5/site-packages/django/core/management/base.py", line 294, in run_from_argv
self.execute(*args, **cmd_options)
File "…/lib/python3.5/site-packages/django/core/management/base.py", line 345, in execute
output = self.handle(*args, **options)
File "…/lib/python3.5/site-packages/django/core/management/commands/test.py", line 72, in handle
failures = test_runner.run_tests(test_labels)
File "…/lib/python3.5/site-packages/django/test/runner.py", line 549, in run_tests
old_config = self.setup_databases()
File "…/lib/python3.5/site-packages/django/test/runner.py", line 499, in setup_databases
self.parallel, **kwargs
File "…/lib/python3.5/site-packages/django/test/runner.py", line 743, in setup_databases
serialize=connection.settings_dict.get("TEST", {}).get("SERIALIZE", True),
File "…/lib/python3.5/site-packages/django/db/backends/base/creation.py", line 78, in create_test_db
self.connection._test_serialized_contents = self.serialize_db_to_string()
File "…/lib/python3.5/site-packages/django/db/backends/base/creation.py", line 122, in serialize_db_to_string
serializers.serialize("json", get_objects(), indent=None, stream=out)
File "…/lib/python3.5/site-packages/django/core/serializers/__init__.py", line 129, in serialize
s.serialize(queryset, **options)
File "…/lib/python3.5/site-packages/django/core/serializers/base.py", line 88, in serialize
self.handle_field(obj, field)
File "…/lib/python3.5/site-packages/django/core/serializers/python.py", line 55, in handle_field
self._current[field.name] = field.value_to_string(obj)
File "…/lib/python3.5/site-packages/markitup/fields.py", line 103, in value_to_string
return value.raw
AttributeError: 'str' object has no attribute 'raw'
Normally I try to narrow the issue down myself. But in this case I don't get anywhere.
I didn't update any packages. These are the packages in question:
Django (1.10.7)
django-markitup (3.0.0)
(The exception disappears when I replace my MarkupField with a standard TextField in models.py.)
Update: The error appears when I use --keepdb successively.
Seems you can fix it by
class MyMarkupField(MarkupField):
def value_to_string(self, obj):
value = self._get_val_from_obj(obj)
if hasattr(value, "raw"):
return value.raw
return value
Then
field = MyMarkupField()
Actually i dont know why this error is coming.
When trying to make migrations in Django I get the following error. Can any help me understand what the problem is and how it possibly can be solved?
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/john/env/lib/python3.5/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
utility.execute()
File "/home/john/env/lib/python3.5/site-packages/django/core/management/__init__.py", line 355, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/john/env/lib/python3.5/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/john/env/lib/python3.5/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/home/john/env/lib/python3.5/site-packages/django/core/management/commands/makemigrations.py", line 150, in handle
loader.project_state(),
File "/home/john/env/lib/python3.5/site-packages/django/db/migrations/loader.py", line 323, in project_state
return self.graph.make_state(nodes=nodes, at_end=at_end, real_apps=list(self.unmigrated_apps))
File "/home/john/env/lib/python3.5/site-packages/django/db/migrations/graph.py", line 409, in make_state
project_state = self.nodes[node].mutate_state(project_state, preserve=False)
File "/home/john/env/lib/python3.5/site-packages/django/db/migrations/migration.py", line 92, in mutate_state
operation.state_forwards(self.app_label, new_state)
File "/home/john/env/lib/python3.5/site-packages/django/db/migrations/operations/fields.py", line 289, in state_forwards
delay = not field.is_relation
UnboundLocalError: local variable 'field' referenced before assignment
I'm using Django 1.11.1 and Python 3.5.
When trying to collectstatic on my heroku server, I get the following error:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 393, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 444, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 168, in handle
collected = self.collect()
File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 107, in collect
handler(path, prefixed_path, storage)
File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 305, in copy_file
if not self.delete_file(path, prefixed_path, source_storage):
File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 218, in delete_file
if self.storage.exists(prefixed_path):
File "/app/.heroku/python/lib/python2.7/site-packages/storages/backends/s3boto.py", line 414, in exists
return k.exists()
File "/app/.heroku/python/lib/python2.7/site-packages/boto/s3/key.py", line 539, in exists
return bool(self.bucket.lookup(self.name, headers=headers))
File "/app/.heroku/python/lib/python2.7/site-packages/boto/s3/bucket.py", line 142, in lookup
return self.get_key(key_name, headers=headers)
File "/app/.heroku/python/lib/python2.7/site-packages/boto/s3/bucket.py", line 192, in get_key
key, resp = self._get_key_internal(key_name, headers, query_args_l)
File "/app/.heroku/python/lib/python2.7/site-packages/boto/s3/bucket.py", line 230, in _get_key_internal
response.status, response.reason, '')
boto.exception.S3ResponseError: S3ResponseError: 403 Forbidden
In my IAM user policies, I have AmazonS3FullAccess added to the user.
Would anyone know how to fix this?
Thank you!