Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

162
Vistas
Django wrong url?

I have two urls.One is for blogs and the other is for games.I have app for games and blogs.

path('',include('games.urls')),
   path('blog',include('blogs.urls')),

My gameapp url is like this:

path('<slug:platform>/<slug:slug>',views.oyun,name='detail'),

My blogapp urls are like this:

path('', views.blogs, name='blog'),
    path('/<slug:slug>', views.blog_id, name='blog_id'),

This url is going to(path('/<slug:slug>', views.blog_id, name='blog_id')), views.oyun so it is giving error. How can i solve this?

Views.py

def blogs(request):
    blogss=blog.objects.all().order_by('-created')
    return render(request,"blog.html",{"blogs":blogss})


def blog_id(request,slug):

    blog_id=blog.objects.get(seo_url=slug)



    return render(request,"blog-writings.html",{"blog_id":blog_id})

def oyun(request,platform,slug):
   oyun = Oyunlar.objects.get(slugyap=slug)


...
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The detail path will capture the URLs that are supposed to fire the blog_id path. Indeed, in the games.urls we see:

path('<slug:platform>/<slug:slug>',views.oyun,name='detail'),

whereas for the blog_id, the complete URL path is:

     'blog/<slug:slug>'

This thus means that if you visit blog/foo, it will fire the oyun view with 'blog' as value for the platform variable, and 'foo' as value for the slug variable.

You can swap the paths, such that it will first inspect the items with a blog/ prefix, and only will fire the oyun view, if that is not the case:

urlpatterns = [
    path('blog',include('blogs.urls')),  # ← first the blog/ paths.
    path('',include('games.urls')),
]
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda