0

I'm having a problem with Dajaxice and how it appears to create a custom javascript file to be used for ajax. When one runs manage.py collectstatic with Dajaxice installed, it creates a custom javascript file. This post references this issue as well. In my case running:

python manage.py findstatic dajaxice/dajaxice.core.js

gives:

Found 'dajaxice/dajaxice.core.js' here:
/private/var/folders/dp/yw0xd2f52yg7qmt992s72_9r0000gn/T/tmpRWRAGT

when run locally. The problem I have is that when pairing this with django-storages and boot to serve static files from Amazon S3, it blows up because that file is created referencing an absolute path instead of a relative path (I think it's boto that doesn't implement something that django-storages doesn't like). The error looks like this:

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 443, in execute_from_command_line
    utility.execute()
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, 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 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 371, in handle
    return self.handle_noargs(**options)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 163, in handle_noargs
    collected = self.collect()
  File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 113, in collect
    handler(path, prefixed_path, storage)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 290, in copy_file
    source_path = source_storage.path(path)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/files/storage.py", line 82, in path
    raise NotImplementedError("This backend doesn't support absolute paths.")

(in this case, I'm deploying on Heroku, which is why I can't just copy the created file manually to a static location and reference it). Is there a way around this? Can I make Dajaxice put the generated file in a relative path location? Or can I get around it by forcing django-storages/boto to accept an absolute path? Or if all else fails, is there an easy way to pre-generate the file short of uninstalling all my S3 dependencies when I collectstatic, copying the file over and forcing Dajax to stop looking for the generated file?

Any help appreciated.

Community
  • 1
  • 1
Leo Mizuhara
  • 365
  • 2
  • 3
  • 15

1 Answers1

0

I have meet this issue, please see https://github.com/jorgebastida/django-dajaxice/issues/66, use

python manager.py collectstatic

tianwei
  • 39
  • 4