Having trouble with django-filebrowser

244 views
Skip to first unread message

Mike Dewhirst

unread,
Dec 16, 2017, 3:04:34 AM12/16/17
to django users
I have tried both django-filebrowser and django-filebrowser-no-grappelli
with django-tinymce4-lite

The TinyMCE part is working fine in the Admin and trying to insert an
image in the text is trying to work and if I pasted in a url it would
probably insert the image it points to.

The problem is there is no browse button in the image-insert dialog box.

The Admin ImageField [Browse] button works fine.

In settings ...
FILEBROWSER_DIRECTORY = '/'

    url(r'^admin/filebrowser/', include(site.urls)),
    url(r'^tinymce/', include('tinymce.urls')),
    url(r'^admin/', admin.site.urls),

Any hints appreciated ..

Thanks

Mike


Mike Dewhirst

unread,
Dec 17, 2017, 3:48:12 PM12/17/17
to Django users
An update. I adjusted settings ...

FILEBROWSER_DIRECTORY = 'uploads/'
FILEBROWSER_VERSIONS_BASEDIR = '_versions/'

.. and to match these dirs ...

'media/_versions/'
'media/uploads/'

Still won't show me an upload or browse button in the insert image dialog.

I also uninstalled and reinstalled to no effect.

Thanks for any help

Mike

Etienne Robillard

unread,
Dec 17, 2017, 5:30:26 PM12/17/17
to Mike Dewhirst, django...@googlegroups.com

Hi Mike,

What Django version are you using? Is this happening with Python 2 or 3?

Have you tried to turn on Python warnings?

Have you tried to use the development verion of django-filebrowser?

HTH

Etienne

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f9a34b92-9005-4cda-a4a6-40efc00dcf28%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
Etienne Robillard
tka...@yandex.com
https://www.isotopesoftware.ca/

Mike Dewhirst

unread,
Dec 17, 2017, 7:37:12 PM12/17/17
to django...@googlegroups.com
On 18/12/2017 9:28 AM, Etienne Robillard wrote:
>
> Hi Mike,
>
> What Django version are you using? Is this happening with Python 2 or 3?
>

Sorry Etienne. Should have mentioned that.

Python 3.6 but it also needs to work with Py27

Django 1.11.8

> Have you tried to turn on Python warnings?
>

C:\Users\mike\envs\xxct3\lib\site-packages\filebrowser\sites.py:12:
RemovedInDjango20Warning: Importing from django.core.urlresolvers is
deprecated in favor of django.urls.
  from django.core.urlresolvers import reverse, get_urlconf, get_resolver
C:\Users\mike\envs\xxct3\train\train\urls.py:113:
RemovedInDjango20Warning: Passing a 3-tuple to
django.conf.urls.include() is deprecated. Pass a 2-tuple containing the
list of patterns and app_name, and provide the namespace argument to
include() instead.
  url(r'^admin/filebrowser/', include(site.urls)),

> Have you tried to use the development verion of django-filebrowser?
>

Yes. Installed from trunk. Same outcome. Here is a screenshot
>> <mailto:django-users...@googlegroups.com>.
>> To post to this group, send email to django...@googlegroups.com
>> <mailto:django...@googlegroups.com>.
>> <https://groups.google.com/d/msgid/django-users/f9a34b92-9005-4cda-a4a6-40efc00dcf28%40googlegroups.com?utm_medium=email&utm_source=footer>.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> Etienne Robillard
> tka...@yandex.com
> https://www.isotopesoftware.ca/
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users...@googlegroups.com
> <mailto:django-users...@googlegroups.com>.
> To post to this group, send email to django...@googlegroups.com
> <mailto:django...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0f1b5957-e66b-4c8a-57ca-85d7848406d6%40yandex.com
> <https://groups.google.com/d/msgid/django-users/0f1b5957-e66b-4c8a-57ca-85d7848406d6%40yandex.com?utm_medium=email&utm_source=footer>.

Mike Dewhirst

unread,
Dec 17, 2017, 10:07:52 PM12/17/17
to django...@googlegroups.com
This time with version 3.9.2 having climbed a little higher into the
branches ...

C:\Users\mike\envs\xxct3\lib\site-packages\django_filebrowser-3.9.2-py3.6.egg\filebrowser\sites.py:12:
RemovedInDjango20Warning: Importing from django.core.urlresolvers is
deprecated in favor of django.urls.
  from django.core.urlresolvers import reverse, get_urlconf, get_resolver
C:\Users\mike\envs\xxct3\train\train\urls.py:113:
RemovedInDjango20Warning: Passing a 3-tuple to
django.conf.urls.include() is deprecated. Pass a 2-tuple containing the
list of patterns and app_name, and provide the namespace argument to
include() instead.
  url(r'^admin/filebrowser/', include(site.urls)),

But no change.

I have also deleted my project/templates/admin folder and still no
change from the screenshot sent earlier - which I did not see so I'll
attach a new one to this email.

Cheers

Mike
--

Climate Pty Ltd
PO Box 308
Mount Eliza
Vic 3930
Australia +61

T: 03 9034 3977
M: 0411 704 143



filebrowser_screenshot.png

Etienne Robillard

unread,
Dec 18, 2017, 4:25:04 AM12/18/17
to Mike Dewhirst, django...@googlegroups.com
Looks likes this is using javascript. What does the javascript console
says? Is the markup of the page valid HTML?

HTH

Etienne

Mike Dewhirst

unread,
Dec 18, 2017, 7:26:59 AM12/18/17
to Etienne Robillard, django...@googlegroups.com
On 18/12/2017 8:23 PM, Etienne Robillard wrote:
> Looks likes this is using javascript. What does the javascript console
> says? Is the markup of the page valid HTML?

I don't have IE. I can't see a Javascript console with either Chrome or
Firefox. What should I look for specifically?

How can I test for valid html? View source and inspect it manually?

Which I just did and it looks ok.

Thanks for sticking with this. I appreciate it.

It is bedtime here.

Cheers

Mike

Mike Dewhirst

unread,
Dec 18, 2017, 7:43:13 AM12/18/17
to Etienne Robillard, django...@googlegroups.com
I was just mousing around and playing with Chrome's tools on the Ubuntu
16.04 staging server and triggered a django error pasted here ...

http://dpaste.com/1G3A8JW

Error finding Upload-Folder (site.storage.location + site.directory)

Could you please explain what the upload folder is?

I'm confused whether it is a constraint to keep the uploader confined on
the source machine or perhaps the area for upload storage on the web
server - which would be a download - and anyway that is the MEDIA_ROOT I
suspect.

Thanks

Mike

Mike Dewhirst

unread,
Dec 28, 2017, 7:20:43 PM12/28/17
to Etienne Robillard, django...@googlegroups.com
Further to this, it is now working nicely on the staging server - Ubuntu
16.04 Apache 2.2 vhost Python 2.7 mod-wsgi

The problem was related to not uninstalling django-tinymce before
installing django-tinymce4-lite and similarly with
django-filebrowser-no-grappelli.

So it looks like your guess was correct. There must have been a
javascript mashup in there somewhere.

However, the same treatment fails on my Windows runserver dev platform.
Brand new virtualenv for Py27 and Py36 still fail to show the little
browse link on the right-hand end of the Source field.

Additionally I *just* noticed there is a Filebrowser app displaying in
the Admin on the staging server but not on the dev site! I'll have to
look into that and report back. If I can get to the bottom of that it
will be the resolution. My CI system guarantees the same source
everywhere so there must be something I'm doing somewhere which is
causing it.

Thank you very much for responding. I reckon it sometimes makes the
difference between giving up (well, working around) and persisting.

Cheers

Mike

James Schneider

unread,
Dec 28, 2017, 11:09:37 PM12/28/17
to django...@googlegroups.com, Etienne Robillard

However, the same treatment fails on my Windows runserver dev platform. Brand new virtualenv for Py27 and Py36 still fail to show the little browse link on the right-hand end of the Source field.

Have you verified that your Windows virtualenv is not including the global system Python libraries as well? There may be a conflict at the system level outside if your virtualenv. Inspecting the search path should reveal where Python is looking.

-James

Mike Dewhirst

unread,
Dec 29, 2017, 12:44:11 AM12/29/17
to django...@googlegroups.com
Definitely. Here is what my "announce.py" called from
train.settings.mike-local shows me every time I launch runserver ...

Train rev: 0.1.0
Settings:  train.settings.mike-local
Python:    3.6.3
Django:    1.11.8
Database:  localhost:5434
Postgres:  9.5.3
Engine:    django.db.backends.postgresql_psycopg2
Cache:     django.core.cache.backends.dummy.DummyCache
Email:     django.core.mail.backends.smtp.EmailBackend
Site ID:   3 - Development
sys.path:  C:\Users\mike\envs\xxct3\train
           C:\Users\mike\envs\xxct3\Scripts\python36.zip
           C:\python36\DLLs
           C:\python36\lib
           C:\python36
           C:\Users\mike\envs\xxct3
           C:\Users\mike\envs\xxct3\lib\site-packages

bleach==2.1.2
certifi==2017.11.5
chardet==3.0.4
Django==1.11.8
django-filebrowser-no-grappelli==3.7.3
django-tinymce4-lite==1.7.0
html5lib==1.0.1
idna==2.6
jsmin==2.2.2
olefile==0.44
Pillow==4.3.0
psycopg2==2.7.3
pytz==2017.3
requests==2.18.4
six==1.11.0
sqlparse==0.2.4
urllib3==1.22
webencodings==0.5.1

SharedTrain Admin   = ad...@sharedsds.com
BASE_DIR            = C:/Users/mike/envs/xxct3/train/train(project root)
SETTINGS_DIR        = C:/Users/mike/envs/xxct3/train/train/settings
MEDIA_ROOT          = C:/var/www/media/train/             (store
uploaded images)
MEDIA_URL           = <website>/media/ (serve uploaded images)
STATIC_ROOT         = C:/var/www/static/train/ (collectstatic dest)
STATIC_URL          = <website>/static/ (serve css, js etc)
STATICFILES_DIRS# 1 = C:/Users/mike/envs/xxct3/train/static/
TEMPLATE DIRS# 1    = C:/Users/mike/envs/xxct3/train/templates/
Launched:  16:32:56

Performing system checks...

Not Apache
System check identified no issues (0 silenced).
December 29, 2017 - 16:33:20
Django version 1.11.8, using settings 'train.settings.mike-local'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

My next trick will be to compare the rendered html from both sites and
try and analyse the differences.

Cheers

Mike


>
> -James
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users...@googlegroups.com
> <mailto:django-users...@googlegroups.com>.
> To post to this group, send email to django...@googlegroups.com
> <mailto:django...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXSOEVnBqrsD9_pnkvPxK0nkcSvZgCZOWogZ8VmFQtOoA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXSOEVnBqrsD9_pnkvPxK0nkcSvZgCZOWogZ8VmFQtOoA%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Mike Dewhirst

unread,
Dec 29, 2017, 5:31:16 PM12/29/17
to django...@googlegroups.com
> On 18/12/2017 8:23 PM, Etienne Robillard wrote:
>> Looks likes this is using javascript. What does the javascript
>> console says? Is the markup of the page valid HTML?
>

The javascript is slightly different between dev on localhost and
staging and I'm totally outta my depth :(

In the <head> section of the staging site which DOES show the upload
widget there is a line which isn't in the localhost dev site ...

<script type="text/javascript" src="/tinymce/filebrowser/"></script>

... which bothers me. It doesn't seem to be a js script???

Another difference is directly beneath the TinyMCE HTMLField textarea.
See NOT IN LOCALHOST SCRIPT below.

<script type="text/javascript">(
function($){
    function tinymce4_init(selector){
        var tinymce4_config={
            'file_browser_callback':djangoFileBrowser, <---- NOT IN
LOCALHOST SCRIPT
setup:function(editor){editor.on('change',function(){editor.save();});},
            "language":"en",
            "contextmenu":"formats | link image",
            "statusbar":true,
            "toolbar1":"formatselect | bold italic underline |
alignleft aligncenter alignright alignjustify | bullist numlist |
outdent indent | table | link image | codesample | preview code",
            "directionality":"ltr",
            "height":360,
            "width":"auto",
            "theme":"modern",
            "plugins":"link image preview codesample contextmenu table
code lists",
            "inline":false,
            "selector":"textarea#id_instruction",
            "menubar":false
        };
        if(typeof selector!='undefined'){
            tinymce4_config['selector']=selector;
        }
        tinymce.init(tinymce4_config);
    }tinymce4_init();
})();
</script>

I have found file_browser_callback in a number of files but really don't
understand javascript well enough to make sense of it. Re-venving and
reinstalling everything

bleach==2.1.2
certifi==2017.11.5
chardet==3.0.4
Django==1.11.8
django-filebrowser-no-grappelli==3.7.3
django-tinymce4-lite==1.7.0
html5lib==1.0.1
idna==2.6
jsmin==2.2.2
olefile==0.44
Pillow==4.3.0
psycopg2==2.7.3
pytz==2017.3
requests==2.18.4
six==1.11.0
urllib3==1.22
webencodings==0.5.1

... doesn't make any difference.

On reflection I'm giving up. It is working on the Ubuntu side and while
I don't understand why I don't have any more time to put into it.

Thank you all very much for your input. It makes this community - and
Django - special.

Cheers

Mike


Etienne Robillard

unread,
Dec 29, 2017, 6:12:07 PM12/29/17
to Mike Dewhirst, django...@googlegroups.com

Mike Dewhirst

unread,
Dec 29, 2017, 6:39:10 PM12/29/17
to django...@googlegroups.com, Etienne Robillard
Etienne

TINYMCE_FILEBROWSER = True

Did the trick.

Vous etes fantastique!

:))

Mike
Reply all
Reply to author
Forward
0 new messages