FinalsClub / karmaworld

KarmaNotes.org v3.0
GNU Affero General Public License v3.0
7 stars 6 forks source link

django compressor: is it doing anything? besides 500 crashing Django? #397

Closed btbonval closed 9 years ago

btbonval commented 9 years ago

While running a local VM, I got an error about some compress key missing and that I needed to run manage.py compress. This is a new issue, but it looks like compress has been around for some time.

The error might have been because I was running a database dumped from the beta system, but that assumes compress uses the database to store stateful information.

It sounds like compress is used to glob together js and css files in a tight format. That's great! But I've never run it manually before.

yourcelf commented 9 years ago

(ps I upgraded django-compressor locally to 1.4; but no improvement)

yourcelf commented 9 years ago

turning in for the night. Good luck. This one's not cracking easily.

btbonval commented 9 years ago

@yourcelf good night, thanks for your help. I would have fumbled around with the wrong project, so you saved me going down the wrong path.

yourcelf commented 9 years ago

There is this: https://github.com/django-compressor/django-compressor/issues/443

btbonval commented 9 years ago

Given the chunk of three CSS files that are causing the missing key error, I noticed that they are all referencing cloudfront. I figured I'd see what's actually there.

http://d2ry5v6uki5dz0.cloudfront.net/static/wysihtml5/toolbar.css is a blank file.

The other two have file contents.

btbonval commented 9 years ago

toolbar.css is empty in the repo. https://github.com/FinalsClub/karmaworld/blob/note-editing/karmaworld/apps/wysihtml5/static/wysihtml5/toolbar.css

I don't know if it is supposed to be empty, but I'm going to remove it from the {compress} to see if it fixes the compress error.

This is apparently where the empty file is coming from: {{ note_edit_form.media.css }}, so I'll comment it out. https://github.com/FinalsClub/karmaworld/blob/note-editing/karmaworld/templates/notes/note_base.html#L9-L15

btbonval commented 9 years ago

woo! moved past that error. new one.

04:54:20 web.1  | OfflineGenerationError: You have offline compression enabled but key "1ea81454b4926d592f670f0172e68ef4" is missing from offline manifest. You may need to run "python manage.py compress". Also forced False and context 
04:54:20 web.1  |     <script src="//d2ry5v6uki5dz0.cloudfront.net/static/js/setup-ajax.js"></script>
04:54:20 web.1  |     <script src="//d2ry5v6uki5dz0.cloudfront.net/static/js/note-detail.js" ></script>
04:54:20 web.1  |     <script src="//d2ry5v6uki5dz0.cloudfront.net/static/js/pxem.jQuery.js"></script>
04:54:20 web.1  |     <script src="//d2ry5v6uki5dz0.cloudfront.net/static/js/marked.js" ></script>
04:54:20 web.1  |     <script src="//d2ry5v6uki5dz0.cloudfront.net/static/js/annotator-full.min.js"></script>
04:54:20 web.1  |     <script type="text/javascript" src="//d2ry5v6uki5dz0.cloudfront.net/static/wysihtml5/wysihtml-0.4.17/dist/wysihtml5x-toolbar.min.js"></script>
04:54:20 web.1  | <script type="text/javascript" src="//d2ry5v6uki5dz0.cloudfront.net/static/wysihtml5/wysihtml-0.4.17/parser_rules/advanced_and_extended.js"></script>
04:54:20 web.1  | <script type="text/javascript" src="//d2ry5v6uki5dz0.cloudfront.net/static/wysihtml5/init.js"></script>
04:54:20 web.1  |  
btbonval commented 9 years ago

not a single empty file in that collection.

btbonval commented 9 years ago

All three wysihtml5 includes are coming from {{ note_edit_form.media.js }} https://github.com/FinalsClub/karmaworld/blob/note-editing/karmaworld/templates/notes/note_base.html#L38

I'll comment that out just to see if I can avoid a 500 error with compress.

yourcelf commented 9 years ago

Try commenting the CSS out too; it's also handled by compress.

btbonval commented 9 years ago

you mean this? https://github.com/FinalsClub/karmaworld/blob/note-editing/karmaworld/templates/notes/note_base.html#L13

I commented that out back in this comment: https://github.com/FinalsClub/karmaworld/issues/397#issuecomment-74811444

yourcelf commented 9 years ago

yup, that one. :)

btbonval commented 9 years ago

Alright commenting out both media includes allows the page to load without a 500 error from compress.

Perhaps we should move those media includes outside of compress so that they are available.

The CSS file was empty, so I could understand why that might cause an issue. The three JS files look alright to me although I didn't look closely.

btbonval commented 9 years ago

Alright I pulled those media tags out of the compress tags. They are being included in the source (albeit directly from static and not inside a compress hash file) and the server isn't throwing a 500.

Visiting /note/harvard/reason-and-faith-in-the-west/resumepdf-5-27-43979, I am seeing an error on the console:

TypeError: m.getComputedStyle(...) is null wysihtml5x-toolbar.min.js:5

I think this is one of the examples @yourcelf had showed me interactively, but with the error, I don't see anything where the note should be. Unsure if that is due to the changes made with how compress works (and thus should stay in this ticket) or if it is worthy of its own ticket.

btbonval commented 9 years ago

Alright, I think this issue is long and worked around. No reason to keep it open.

I created a ticket to follow up with django-compressor and wysihtml5. #401

I created a ticket to troubleshoot the wysihtml5 typeerror that doesn't belong in this ticket. #402