Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static file error with heroku #70

Open
cxrodgers opened this issue Jul 31, 2016 · 2 comments
Open

Static file error with heroku #70

cxrodgers opened this issue Jul 31, 2016 · 2 comments

Comments

@cxrodgers
Copy link

Hi, I'd like to use nested_inline on a django instance running on heroku. Everything works great locally, but I'm getting an error on the heroku server, for some reason.

I followed the heroku guide to getting a minimal django setup working:
https://devcenter.heroku.com/articles/getting-started-with-python#introduction
So far, so good.

Then I added "django-nested-inline" to my requirements.txt, added 'nested_inline' to the end of my INSTALLED_APPS, and "from nested_inline.admin import NestedModelAdmin, NestedStackedInline" to my admin.py.

Everything still works perfectly locally, with no issues. But when I push to heroku "git push heroku master", I get the following error:
git push heroku master
Counting objects: 7, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 670 bytes | 0 bytes/s, done.
Total 7 (delta 5), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: $ pip install -r requirements.txt
remote: Collecting django-nested-inline (from -r requirements.txt (line 6))
remote: Downloading django-nested-inline-0.3.6.tar.gz
remote: Installing collected packages: django-nested-inline
remote: Running setup.py install for django-nested-inline: started
remote: Running setup.py install for django-nested-inline: finished with status 'done'
remote: Successfully installed django-nested-inline-0.3.6
remote:
remote: $ python manage.py collectstatic --noinput
remote: Post-processing 'admin/css/forms-nested.css' failed!
remote: Traceback (most recent call last):
remote: File "manage.py", line 10, in
remote: execute_from_command_line(sys.argv)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/init.py", line 353, in execute_from_command_line
remote: utility.execute()
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/init.py", line 345, in execute
remote: self.fetch_command(subcommand).run_from_argv(self.argv)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 348, in run_from_argv
remote: self.execute(_args, *_cmd_options)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 399, in execute
remote: output = self.handle(_args, *_options)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 176, in handle
remote: collected = self.collect()
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 128, in collect
remote: raise processed
remote: whitenoise.django.MissingFileError: The file 'admin/img/nav-bg.gif' could not be found with <whitenoise.django.GzipManifestStaticFilesStorage object at 0x7f23006c2910>.
remote: The CSS file 'admin/css/forms-nested.css' references a file which could not be found:
remote: admin/img/nav-bg.gif
remote: Please check the URL references in this CSS file, particularly any
remote: relative paths which might be pointing to the wrong location.
remote:
remote: ! Error while running '$ python manage.py collectstatic --noinput'.
remote: See traceback above for details.
remote:
remote: You may need to update application code to resolve this error.
remote: Or, you can disable collectstatic for this application:
remote:
remote: $ heroku config:set DISABLE_COLLECTSTATIC=1
remote:
remote: https://devcenter.heroku.com/articles/django-assets

I'm confused about why it's working differently on heroku than locally. Also, I can't find that nav-bg.gif file anywhere, but this doesn't stop nested_inline from working locally. Thanks for any tips! I realize this may be a heroku-specific issue, but I thought posting here would be more likely to reach someone who can identify the problem.

@cxrodgers
Copy link
Author

I think I see what the problem is. There is no "img" directory in nested_inline/static/admin/ in this repository, yet many lines of forms_nested.css refer to it. Maybe they were inadvertently left out of source control? Previous versions of django or whitenoise may have silently ignored missing files, but now they raise exceptions. I fixed it by simply removing every line of forms_nested.css that refers to ../img. I created a fork on my own github page so that I can add it to my requirements.txt with heroku.
git+git://github.com/cxrodgers/django-nested-inline.git

@smcoll
Copy link
Contributor

smcoll commented Jul 24, 2017

OK, it looks like that was an image which used to exist in Django. The other images are included still available in Django's static media, but as svg. See this commit: django/django@35901e6

So, really what is needed is support for the new Django admin theme.

smcoll added a commit to smcoll/django-nested-inline that referenced this issue Jul 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants