wooey / Wooey

A Django app that creates automatic web UIs for Python scripts.
http://wooey.readthedocs.org
BSD 3-Clause "New" or "Revised" License
2.11k stars 182 forks source link

NotImplementedError: This backend doesn't support absolute paths. #342

Closed bt-jerryimiolo closed 2 years ago

bt-jerryimiolo commented 3 years ago

Hello,

First off thank you for taking the time to read this and respond. I'm relatively new to python, but have quite a bit of web dev experience under my belt.

Anyways, I've been tasked with developing a web wrapper for various command line scripts that were developed for a different department. I came across Wooey and thought this would be perfect. I've installed it locally, played around, and everything works great! So I decided to launch a production site on Heroku following the documentation. There were a couple hiccups here and there, but nothing I couldn't work through. Finally got to the point where I was about to hand it off but decided to try one of your test scripts first. I get a 500 error with the "NotImplementedError: This backend doesn't support absolute paths." description. Below is the stack trace. Another note, I had to change the requirements and settings to use boto3 since Heroku wasn't accepting boto any longer. I am hoping it is something simple that I may have overlooked, but I can't find any additional resources to help further.

Happy to answer any questions or provide any additional details. Any help is greatly appreciated.

2021-08-19T21:56:17.572074+00:00 app[web.1]: ERROR:django.request:Internal Server Error: /admin/wooey/script/add/ 2021-08-19T21:56:17.572085+00:00 app[web.1]: Traceback (most recent call last): 2021-08-19T21:56:17.572086+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner 2021-08-19T21:56:17.572086+00:00 app[web.1]: response = get_response(request) 2021-08-19T21:56:17.572088+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response 2021-08-19T21:56:17.572088+00:00 app[web.1]: response = wrapped_callback(request, *callback_args, callback_kwargs) 2021-08-19T21:56:17.572088+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/admin/options.py", line 616, in wrapper 2021-08-19T21:56:17.572089+00:00 app[web.1]: return self.admin_site.admin_view(view)(*args, *kwargs) 2021-08-19T21:56:17.572089+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/utils/decorators.py", line 130, in _wrapped_view 2021-08-19T21:56:17.572089+00:00 app[web.1]: response = view_func(request, args, kwargs) 2021-08-19T21:56:17.572090+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func 2021-08-19T21:56:17.572090+00:00 app[web.1]: response = view_func(request, *args, kwargs) 2021-08-19T21:56:17.572090+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/admin/sites.py", line 232, in inner 2021-08-19T21:56:17.572091+00:00 app[web.1]: return view(request, *args, *kwargs) 2021-08-19T21:56:17.572091+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/admin/options.py", line 1657, in add_view 2021-08-19T21:56:17.572091+00:00 app[web.1]: return self.changeform_view(request, None, form_url, extra_context) 2021-08-19T21:56:17.572091+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/utils/decorators.py", line 43, in _wrapper 2021-08-19T21:56:17.572092+00:00 app[web.1]: return bound_method(args, kwargs) 2021-08-19T21:56:17.572092+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/utils/decorators.py", line 130, in _wrapped_view 2021-08-19T21:56:17.572092+00:00 app[web.1]: response = view_func(request, *args, *kwargs) 2021-08-19T21:56:17.572092+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/admin/options.py", line 1540, in changeform_view 2021-08-19T21:56:17.572092+00:00 app[web.1]: return self._changeform_view(request, object_id, form_url, extra_context) 2021-08-19T21:56:17.572093+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/admin/options.py", line 1587, in _changeform_view 2021-08-19T21:56:17.572093+00:00 app[web.1]: self.save_related(request, form, formsets, not add) 2021-08-19T21:56:17.572093+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/admin/options.py", line 1127, in save_related 2021-08-19T21:56:17.572093+00:00 app[web.1]: self.save_formset(request, form, formset, change=change) 2021-08-19T21:56:17.572094+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/admin/options.py", line 1115, in save_formset 2021-08-19T21:56:17.572094+00:00 app[web.1]: formset.save() 2021-08-19T21:56:17.572094+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/forms/models.py", line 681, in save 2021-08-19T21:56:17.572094+00:00 app[web.1]: return self.save_existing_objects(commit) + self.save_new_objects(commit) 2021-08-19T21:56:17.572095+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/forms/models.py", line 819, in save_new_objects 2021-08-19T21:56:17.572095+00:00 app[web.1]: self.new_objects.append(self.save_new(form, commit=commit)) 2021-08-19T21:56:17.572095+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/forms/models.py", line 961, in save_new 2021-08-19T21:56:17.572095+00:00 app[web.1]: return super().save_new(form, commit=commit) 2021-08-19T21:56:17.572095+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/forms/models.py", line 658, in save_new 2021-08-19T21:56:17.572096+00:00 app[web.1]: return form.save(commit=commit) 2021-08-19T21:56:17.572096+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/forms/models.py", line 468, in save 2021-08-19T21:56:17.572096+00:00 app[web.1]: self.instance.save() 2021-08-19T21:56:17.572096+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/wooey/models/mixins.py", line 53, in save 2021-08-19T21:56:17.572096+00:00 app[web.1]: super(ModelDiffMixin, self).save(args, kwargs) 2021-08-19T21:56:17.572096+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/db/models/base.py", line 726, in save 2021-08-19T21:56:17.572097+00:00 app[web.1]: self.save_base(using=using, force_insert=force_insert, 2021-08-19T21:56:17.572097+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/db/models/base.py", line 774, in save_base 2021-08-19T21:56:17.572097+00:00 app[web.1]: post_save.send( 2021-08-19T21:56:17.572097+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/dispatch/dispatcher.py", line 180, in send 2021-08-19T21:56:17.572098+00:00 app[web.1]: return [ 2021-08-19T21:56:17.572098+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/dispatch/dispatcher.py", line 181, in 2021-08-19T21:56:17.572098+00:00 app[web.1]: (receiver, receiver(signal=self, sender=sender, named)) 2021-08-19T21:56:17.572099+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/wooey/signals.py", line 57, in script_version_postsave 2021-08-19T21:56:17.572099+00:00 app[web.1]: res = utils.add_wooey_script(script_version=instance, group=instance.script.script_group) 2021-08-19T21:56:17.572099+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/wooey/backend/utils.py", line 237, in add_wooey_script 2021-08-19T21:56:17.572105+00:00 app[web.1]: with get_storage_object(script_path) as so: 2021-08-19T21:56:17.572105+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/contextlib.py", line 117, in enter 2021-08-19T21:56:17.572105+00:00 app[web.1]: return next(self.gen) 2021-08-19T21:56:17.572105+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/wooey/backend/utils.py", line 219, in get_storage_object 2021-08-19T21:56:17.572105+00:00 app[web.1]: obj.path = storage.path(path) 2021-08-19T21:56:17.572106+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/django/core/files/storage.py", line 123, in path 2021-08-19T21:56:17.572106+00:00 app[web.1]: raise NotImplementedError("This backend doesn't support absolute paths.") 2021-08-19T21:56:17.572106+00:00 app[web.1]: NotImplementedError: This backend doesn't support absolute paths. 2021-08-19T21:56:17.572108+00:00 app[web.1]: NoneType: None 2021-08-19T21:56:17.572160+00:00 app[web.1]: NoneType: None

Chris7 commented 3 years ago

Could you elaborate on your storage backend? There is a brief section on running heroku here: https://wooey.readthedocs.io/en/latest/remote.html

bt-jerryimiolo commented 3 years ago

Hey Chris, Thank you for the reply. I did follow that doc, but adjusted it for boto3. I have the following settings in user_settings.py:

STATICFILES_STORAGE = DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' WOOEY_EPHEMERAL_FILES = True

I got that from https://django-storages.readthedocs.io/en/1.11.1/backends/amazon-S3.html

Chris7 commented 2 years ago

Sorry for the late reply,

STATICFILES_STORAGE = DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' does not have the path method overwritten to provide a fallback location to the local storage. The latest version of the cached storage backend uses boto3 (were you having issues with it?)