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

Fix for crashes when using tinymce in STATICFILES_DIRS in development mode. #131

Merged
merged 1 commit into from
Sep 9, 2015

Conversation

Felix-neko
Copy link

Here I've added some quick and dirty fix when using STATICFILES_DIRS instead of STATIC_ROOT.

@@ -13,9 +13,12 @@

if 'staticfiles' in settings.INSTALLED_APPS or 'django.contrib.staticfiles' in settings.INSTALLED_APPS:
JS_URL = getattr(settings, 'TINYMCE_JS_URL',os.path.join(settings.STATIC_URL, 'tiny_mce/tiny_mce.js'))
JS_ROOT = getattr(settings, 'TINYMCE_JS_ROOT',os.path.join(settings.STATIC_ROOT, 'tiny_mce'))
JS_ROOT = getattr(settings, 'TINYMCE_JS_ROOT', None)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use the static library to build the right PATH here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static library? What do you mean?

[scratching head]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Natim
Copy link
Collaborator

Natim commented Sep 9, 2015

Actually it doesn't really makes sense to use STATICDIRS without a STATIC_ROOT because collectstatic will copy files from STATICDIRS to STATIC_ROOT

@Felix-neko
Copy link
Author

Alas, it does make sense when we use the debug server.

@Natim
Copy link
Collaborator

Natim commented Sep 9, 2015

Alas, it does make sense when we use the debug server.

Yes true.

Then we should use:

from django.contrib.staticfiles import finders
finders.find('tiny_mce', all=False)

@Felix-neko
Copy link
Author

And where should I copy-paste the code? To settings.py of my project?

It doesn't work...

[piteously meowing]

@Natim
Copy link
Collaborator

Natim commented Sep 9, 2015

@Felix-neko
Copy link
Author

Done, check it up please.
^__^

@Natim
Copy link
Collaborator

Natim commented Sep 9, 2015

I think it is something we want to do if staticfiles is present in the INSTALLED_APPS and not if we use MEDIA.

Also please remove the documentation changes.

@Felix-neko
Copy link
Author

Also please remove the documentation changes.
Done.

I think it is something we want to do if staticfiles is present in the INSTALLED_APPS and not if we use MEDIA.

Alas, I don't understand what do you mean. Maybe that's because I'm not a pro Django coder. = (

@Natim
Copy link
Collaborator

Natim commented Sep 9, 2015

Look at the diff, you should see that you removed os.path.join(settings.STATIC_ROOT, 'tiny_mce') please replace it with the finders.find() call, also place the import at the top of the file (in the alphabetical order)

@Natim Natim changed the title Added quick and dirty fix for crashes when using STATICFILES_DIRS Fix for crashes when using tinymce in STATICFILES_DIRS in development mode. Sep 9, 2015
@Felix-neko
Copy link
Author

[hopefully]

Maybe you'll modify it yourself?

@Natim
Copy link
Collaborator

Natim commented Sep 9, 2015

It's your PR and your fix isn't it?

@Felix-neko
Copy link
Author

Okay, let's do it...

@Felix-neko
Copy link
Author

Done. Is it good enough?

@Natim
Copy link
Collaborator

Natim commented Sep 9, 2015

I will let line 19 as it was otherwise it looks to be good yes.

@Felix-neko
Copy link
Author

Done!

@Natim
Copy link
Collaborator

Natim commented Sep 9, 2015

Thanks a lot. It looks good for me.

Natim added a commit that referenced this pull request Sep 9, 2015
Fix for crashes when using tinymce in STATICFILES_DIRS in development mode.
@Natim Natim merged commit 1560ba9 into jazzband:master Sep 9, 2015
@Felix-neko
Copy link
Author

Thank you, comrade!
^____^

@Natim
Copy link
Collaborator

Natim commented Sep 9, 2015

I just released 2.0.5 with your fix.

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

Successfully merging this pull request may close these issues.

2 participants