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!
Related
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>.
I am getting the following error when I try to start the server locally (./manage.py runserver).
Posting the question after spending 5 hours of searching solution.
Attached the error stack. I am using Django 2.2.2.
Watching for file changes with StatReloader
Performing system checks...
Traceback (most recent call last):
File "./manage.py", line 26, in <module>
execute_from_command_line(sys.argv)
File "/home/santhosh/Desktop/working_dir/piccolo/venv/lib/python3.5/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/home/santhosh/Desktop/working_dir/piccolo/venv/lib/python3.5/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/santhosh/Desktop/working_dir/piccolo/venv/lib/python3.5/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/santhosh/Desktop/working_dir/piccolo/venv/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 60, in execute
super().execute(*args, **options)
File "/home/santhosh/Desktop/working_dir/piccolo/venv/lib/python3.5/site-packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/home/santhosh/Desktop/working_dir/piccolo/venv/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 95, in handle
self.run(**options)
File "/home/santhosh/Desktop/working_dir/piccolo/venv/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 102, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "/home/santhosh/Desktop/working_dir/piccolo/venv/lib/python3.5/site-packages/django/utils/autoreload.py", line 585, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "/home/santhosh/Desktop/working_dir/piccolo/venv/lib/python3.5/site-packages/django/utils/autoreload.py", line 570, in start_django
reloader.run(django_main_thread)
File "/home/santhosh/Desktop/working_dir/piccolo/venv/lib/python3.5/site-packages/django/utils/autoreload.py", line 288, in run
self.run_loop()
File "/home/santhosh/Desktop/working_dir/piccolo/venv/lib/python3.5/site-packages/django/utils/autoreload.py", line 294, in run_loop
next(ticker)
File "/home/santhosh/Desktop/working_dir/piccolo/venv/lib/python3.5/site-packages/django/utils/autoreload.py", line 334, in tick
for filepath, mtime in self.snapshot_files():
File "/home/santhosh/Desktop/working_dir/piccolo/venv/lib/python3.5/site-packages/django/utils/autoreload.py", line 350, in snapshot_files
for file in self.watched_files():
File "/home/santhosh/Desktop/working_dir/piccolo/venv/lib/python3.5/site-packages/django/utils/autoreload.py", line 249, in watched_files
yield from iter_all_python_module_files()
File "/home/santhosh/Desktop/working_dir/piccolo/venv/lib/python3.5/site-packages/django/utils/autoreload.py", line 103, in iter_all_python_module_files
return iter_modules_and_files(modules, frozenset(_error_files))
File "/home/santhosh/Desktop/working_dir/piccolo/venv/lib/python3.5/site-packages/django/utils/autoreload.py", line 116, in iter_modules_and_files
if module.__name__ == '__main__':
File "/usr/lib/python3/dist-packages/py/_apipkg.py", line 171, in __getattribute__
return getattr(getmod(), name)
File "/usr/lib/python3/dist-packages/py/_error.py", line 43, in __getattr__
raise AttributeError(name)
AttributeError: __name__
Thanks in advance.
I just got done upgrading to Django 2.2.3 from version 2.0.
For some reason the system will just stop working when going to a new page. I might go one or to pages and then the server stops.
I am also using Cookiecutter.
Below is a typical message that I am receiving. Though it changes.
it was acting strange before this - why I upgraded.
I checked all my migrations. Reinstalled Django. Using Pycharm.
Thanks.
[17/Jul/2019 08:26:04] "GET /account/login/ HTTP/1.1" 200 13126
[17/Jul/2019 08:26:04] "GET /static/CACHE/css/app.8e450f098f62.css HTTP/1.1" 200 323872
AttributeError: cffi library '_ffi' has no function, constant or global variable named '__spec__'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/benson/PycharmProjects/myanalysis/manage.py", line 29, in <module>
execute_from_command_line(sys.argv)
File "/Users/benson/PycharmProjects/myanalysis/v_env/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/Users/benson/PycharmProjects/myanalysis/v_env/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/benson/PycharmProjects/myanalysis/v_env/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/benson/PycharmProjects/myanalysis/v_env/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 60, in execute
super().execute(*args, **options)
File "/Users/benson/PycharmProjects/myanalysis/v_env/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/Users/benson/PycharmProjects/myanalysis/v_env/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 95, in handle
self.run(**options)
File "/Users/benson/PycharmProjects/myanalysis/v_env/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 102, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "/Users/benson/PycharmProjects/myanalysis/v_env/lib/python3.6/site-packages/django/utils/autoreload.py", line 579, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "/Users/benson/PycharmProjects/myanalysis/v_env/lib/python3.6/site-packages/django/utils/autoreload.py", line 564, in start_django
reloader.run(django_main_thread)
File "/Users/benson/PycharmProjects/myanalysis/v_env/lib/python3.6/site-packages/django/utils/autoreload.py", line 275, in run
self.run_loop()
File "/Users/benson/PycharmProjects/myanalysis/v_env/lib/python3.6/site-packages/django/utils/autoreload.py", line 281, in run_loop
next(ticker)
File "/Users/benson/PycharmProjects/myanalysis/v_env/lib/python3.6/site-packages/django/utils/autoreload.py", line 321, in tick
state.update(self.loop_files(state, previous_timestamp))
File "/Users/benson/PycharmProjects/myanalysis/v_env/lib/python3.6/site-packages/django/utils/autoreload.py", line 328, in loop_files
for path, mtime in self.snapshot_files():
File "/Users/benson/PycharmProjects/myanalysis/v_env/lib/python3.6/site-packages/django/utils/autoreload.py", line 348, in snapshot_files
for file in self.watched_files():
File "/Users/benson/PycharmProjects/myanalysis/v_env/lib/python3.6/site-packages/django/utils/autoreload.py", line 241, in watched_files
yield from iter_all_python_module_files()
File "/Users/benson/PycharmProjects/myanalysis/v_env/lib/python3.6/site-packages/django/utils/autoreload.py", line 103, in iter_all_python_module_files
return iter_modules_and_files(modules, frozenset(_error_files))
File "/Users/benson/PycharmProjects/myanalysis/v_env/lib/python3.6/site-packages/django/utils/autoreload.py", line 114, in iter_modules_and_files
if not isinstance(module, ModuleType) or getattr(module, '__spec__', None) is None:
SystemError: <built-in function getattr> returned a result with an error set
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.