1

I made URL config

urlpatterns = [
  path('', lambda request: redirect('stocks', permanent=False)),
  path('stocks', views.stocks.index, name='stocks.index'),
  path('stocks/<slug:slug>', views.stocks.show, name='stocks.show'),
  path('stocks/<slug:slug>/load', views.stocks.load, name='stocks.load')
]

These URLs are ok, and they work but not first

  path('', lambda request: redirect('stocks', permanent=False)),

It gives when I try http://127.0.0.1:8000

NoReverseMatch at /

Reverse for 'stocks' not found. 'stocks' is not a valid view function or pattern name.

But if I try http://127.0.0.1:8000/stocks all is ok

What's wrong here?

1 Answer 1

1

Probably you should use stocks.index instead of stocks

path('', lambda request: redirect('stocks.index', permanent=False)),
Sign up to request clarification or add additional context in comments.

2 Comments

Yep thanks. So stupid of me! I'll delete the question
Well no SO says better not delete questions with answers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.