Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

159
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!