django tinymce django filebrowset tinymce_popup.js 404

489 views Asked by At

I'm facing a 404 object not found with django filebrowser and django-tinymce. The problem is, when I want to select an image previously uploaded, I can't continue to introduce it in my HTMLField.

here are my settings :

TINYMCE_SPELLCHECKER = True
TINYMCE_COMPRESSOR = True
TINYMCE_FILEBROWSER = True
# file_browser

# import filebrowser
# STATICFILES_DIRS += (os.path.join(os.path.dirname(filebrowser.__file__), 'static/'),)

ADMIN_MEDIA_PREFIX = '/media/admin/'
TINYMCE_JS_URL = ADMIN_MEDIA_PREFIX + 'tiny_mce/tiny_mce_src.js'
URL_FILEBROWSER_MEDIA = ADMIN_MEDIA_PREFIX + 'filebrowser/'
FILEBROWSER_URL_TINYMCE = ADMIN_MEDIA_PREFIX + 'tiny_mce/'

FILEBROWSER_MEDIA_ROOT = MEDIA_ROOT
FILEBROWSER_MEDIA_URL = MEDIA_URL
FILEBROWSER_STATIC_ROOT = STATIC_ROOT
FILEBROWSER_STATIC_URL = STATIC_URL
URL_FILEBROWSER_MEDIA = STATIC_URL + 'filebrowser/'
PATH_FILEBROWSER_MEDIA = STATIC_ROOT + 'filebrowser/'
URL_TINYMCE = STATIC_URL + 'tiny_mce/'
PATH_TINYMCE = STATIC_ROOT + 'tiny_mce/'


FILEBROWSER_EXTENSIONS =  {
'Image': ['.jpg','.jpeg','.gif','.png','.tif','.tiff'],
'Video': ['.mov','.wmv','.mpeg','.mpg','.avi','.rm'],
'Audio': ['.mp3','.mp4','.wav','.aiff','.midi','.m4p']
}


FILEBROWSER_VERSIONS = {
'fb_thumb': {'verbose_name': 'Admin Thumbnail', 'width': 60, 'height': 60, 'opts': 'crop        upscale'},
'thumbnail': {'verbose_name': 'Thumbnail (140px)', 'width': 140, 'height': '', 'opts': ''},
'small': {'verbose_name': 'Small (300px)', 'width': 300, 'height': '', 'opts': ''},
'medium': {'verbose_name': 'Medium (460px)', 'width': 460, 'height': '', 'opts': ''},
'big': {'verbose_name': 'Big (620px)', 'width': 620, 'height': '', 'opts': ''},
'cropped': {'verbose_name': 'Cropped (60x60px)', 'width': 60, 'height': 60, 'opts': 'crop'},
'croppedthumbnail': {'verbose_name': 'Cropped Thumbnail (140x140px)', 'width': 140, 'height': 140, 'opts': 'crop'},
}

FILEBROWSER_ADMIN_VERSIONS = ['thumbnail','small', 'medium','big']
FILEBROWSER_ADMIN_THUMBNAIL = ('fb_thumb')

urls

url(r'^admin/filebrowser/', include(site.urls)),
# url(r'^atmosphere/', include('atmosphere.foo.urls')),

# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
(r'^tinymce/', include('tinymce.urls')),
(r'^grappelli/', include('grappelli.urls')),

Installed apps :

'filebrowser',
'grappelli',
'tinymce',
'django.contrib.admin',

Admin :

class ArticleAdmin(admin.ModelAdmin):
    # sets values for how the admin site lists your products
    list_display = (u'title', u'author', u'created_at', u'pub_date',)
    list_display_links = (u'title', u'created_at')
    list_per_page = 20
    ordering = [u'-created_at']
    search_fields = [u'title', u'content', u'meta_keywords', u'meta_description']
    # sets up slug to be generated from product title
    prepopulated_fields = {u'slug': (u'title',)}

class Media:
    js = (
        '/static/tiny_mce/tiny_mce.js',
        'modeltranslation/js/force_jquery.js',
        'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js',
        'modeltranslation/js/tabbed_translation_fields.js',
    )
    css = {'screen': ('modeltranslation/css/tabbed_translation_fields.css',),}

And the error

/media/admin/tiny_mce/tiny_mce_popup.js HTTP/1.1" 404 1729

I don't know how to do it. If you have any advice, thank you in advance!

2

There are 2 answers

1
DaschPyth On BEST ANSWER

It was a mistake in the tinymce_url . I specified the js file and not the folder.

thanks :)

3
Sandeep Balagopal On

type this url "your_site/media/admin/tiny_mce/tiny_mce_popup.js" in your web browser and see whether this file loads.