jazzband / django-embed-video

Django app for easy embedding YouTube and Vimeo videos and music from SoundCloud.
http://django-embed-video.rtfd.org
MIT License
383 stars 137 forks source link

UnknownBackendException from examples #85

Closed microwriting closed 4 years ago

microwriting commented 6 years ago

Hello, I am making my website using django-embed-video.

Since I'm thinking about starting with a configuration that is as simple as possible, I made a website only index.html, then I installed django-embed-video. Then I added following code base on the tutorial, however, it doesn't display youtube video and display following error message.

My environment is as follows. django 2.0 django-embed-video 1.1.2

error message

Backend wasn't recognised (``)
Traceback (most recent call last):
  File "F:\django_project\virtualenv2\lib\site-packages\embed_video\templatetags\embed_video_tags.py", line 111, in render
    return self.embed(url, size, context=context, **options)
  File "F:\django_project\virtualenv2\lib\site-packages\embed_video\templatetags\embed_video_tags.py", line 185, in embed
    backend = cls.get_backend(url, context=context, **options)
  File "F:\django_project\virtualenv2\lib\site-packages\embed_video\templatetags\embed_video_tags.py", line 164, in get_backend
    else detect_backend(str(backend_or_url))
  File "F:\django_project\virtualenv2\lib\site-packages\embed_video\backends.py", line 62, in detect_backend
    raise UnknownBackendException
embed_video.backends.UnknownBackendException

stteings.py

INSTALLED_APPS = [
'embed_video',
]

Since django default added 'django.template.context_processors.request' by default in 'context_processors' of TEMPLATES, so I didn't add anything in settings.py except above code.

models.py

class Item(models.Model):
    name = models.CharField('Video name', max_length=100, null=True)
    video = models.URLField()  # same like models.URLField()

view.py

from django.shortcuts import render

def index(request):
    return render(request, 'app/index.html')

admin.py

from django.contrib import admin
from embed_video.admin import AdminVideoMixin
from .models import Item

class MyModelAdmin(AdminVideoMixin, admin.ModelAdmin):
    pass

admin.site.register(Item, MyModelAdmin)

index.html

{% extends "app/base.html" %}
{% load embed_video_tags %}
{% block content %}
{% video item.video 'small' %}
{% endblock %}

Custom backends have not made anything. What is the cause this problem?

SalahAdDin commented 4 years ago

@CedricCarrard Why did you close this bug?

aleksihakli commented 4 years ago

I think this has to do with the example application and code having incorrect examples and we should fix those, reopening for further discussion.

reyesvicente commented 4 years ago

I'm getting this now

[11/Oct/2019 17:42:26] "GET / HTTP/1.1" 200 25285
Backend wasn't recognised (``)
Traceback (most recent call last):
  File "/root/myproject/env/lib/python3.6/site-packages/embed_video/templatetags/embed_video_tags.py", line 111, in render
    return self.embed(url, size, context=context, **options)
  File "/root/myproject/env/lib/python3.6/site-packages/embed_video/templatetags/embed_video_tags.py", line 185, in embed
    backend = cls.get_backend(url, context=context, **options)
  File "/root/myproject/env/lib/python3.6/site-packages/embed_video/templatetags/embed_video_tags.py", line 164, in get_backend
    else detect_backend(str(backend_or_url))
  File "/root/myproject/env/lib/python3.6/site-packages/embed_video/backends.py", line 57, in detect_backend
    raise UnknownBackendException
embed_video.backends.UnknownBackendException
aleksihakli commented 4 years ago

@reyesvicente what version of the library are you using, and is this a new or old project?

reyesvicente commented 4 years ago

@reyesvicente what version of the library are you using, and is this a new or old project?

Im using django-embed-video==1.3

aleksihakli commented 4 years ago

Closing as no further reports have come in. Please let us know if you want this ticket reopened.