1👍
✅
You can define app_name
in app’s urls.py, like so:
from django.urls import path
from .views import *
app_name='plataforma'
urlpatterns = [
path('', PlataformaView.as_view(), name='plataforma_view'),
path('stream/', StreamView.as_view(), name='stream'),
path('transmition/', transmition, name='transmition'),
]
Then use it while calling in URL tag as:
<img src="{% url 'plataforma:transmition' %}">
You can give any app_name
according to your need.
Edit
You should also remove unnecessary routes in project’s urls.py, so it should like this:
from django.contrib import admin
from django.urls import path, include
from django.conf.urls.static import static
from django.conf import settings
from plataforma.views import *
from django.views.generic.base import TemplateView
urlpatterns = [
path("admin/", admin.site.urls),
path('contas/', include('django.contrib.auth.urls')),
path('', TemplateView.as_view(template_name='index.html'), name='index'),
path('plataforma/', include('plataforma.urls'), namespace='plataforma')
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Source:stackexchange.com