[DRF] Issue Report - Reverse for 'urlname' not found

Yungsang Hwangยท2022๋…„ 7์›” 13์ผ
0

Django-Rest-Framework

๋ชฉ๋ก ๋ณด๊ธฐ
9/15

Issue Report - Reverse for 'urlname' not found.


๐ŸŒง์ƒํ™ฉ

  • ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ž‘์„ฑ์„ ์œ„ํ•ด urls.py ์— path ๊ฒฝ๋กœ์— ์ง€์ •ํ•ด๋‘” name์„ ํ™œ์šฉํ•˜์—ฌ reverse๋ฅผ ํ†ตํ•ด ํ•ด๋‹น ๊ฒฝ๋กœ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋˜ ์ค‘ โ€˜Reverse for โ€˜urlnameโ€™ not foundโ€™๋ผ๋Š” ์˜ค๋ฅ˜๋ฅผ ๋งŒ๋‚˜๊ฒŒ ๋˜์—ˆ๋‹ค
  • ๊ธฐ์กด์— user์•ฑ์—์„œ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ๋ฅผ ์ง„ํ–‰ํ–ˆ์„ ๋• name์„ ํ™œ์šฉํ•˜์—ฌ reverse๋ฅผ ์ง€์ •ํ•˜์—ฌ ์•„๋ฌด๋Ÿฐ ๋ฌธ์ œ๊ฐ€ ์—†์—ˆ๊ธฐ์— ์ƒˆ๋กœ์šด ์•ฑ์—์„œ๋„ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜๋ฆฌ๋ผ๊ณ ๋Š” ์ƒ๊ฐํ•˜์ง€ ๋ชปํ–ˆ๋Š”๋ฐ ๊ฝค๋‚˜ ๋‹นํ™ฉ์Šค๋Ÿฌ์› ๋‹ค. ๊ตฌ๊ธ€๋ง์„ ํ†ตํ•ด ์ผ๋‹จ ๊ธฐ๋ณธ urls.py ์— ์•ฑ๋„ค์ด๋ฐ์„ ๋ณ„๋„๋กœ ํ•ด์ฃผ์—ˆ๊ณ , reverse ๋‚ด์—๋„ ์•ฑ๋„ค์ด๋ฐ์„ ์—ฐ๊ด€์ง€์–ด ์ง€์ •ํ•ด์ฃผ์–ด ํ•ด๊ฒฐ์€ ํ•˜์˜€๋Š”๋ฐ user์•ฑ์—์„œ ์ฒ˜๋Ÿผ ๋ณ„๋„๋กœ ์•ฑ๋„ค์ด๋ฐ์„ ์ง€์ •ํ•ด์ฃผ์ง€ ์•Š์•„๋„ ์ž˜ ๋™์ž‘ํ•˜๋Š” ์ฝ”๋“œ๋“ค์ด ์žˆ์–ด์„œ ์ด์œ ๋ฅผ ์•Œ๊ณ ์ž ํŠธ๋Ÿฌ๋ธ” ์ŠˆํŒ…์„ ์‹œ๋„ํ•˜๊ฒŒ ๋˜์—ˆ๋‹ค (์ผ๋ช… ์™œ ๋ผ? ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•œ ์ผ€์ด์Šค)

๐Ÿ› ์˜ค๋ฅ˜์ฝ”๋“œ

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

๐Ÿš€ํŠธ๋Ÿฌ๋ธ”์ŠˆํŒ…

  • ์ฒ˜์Œ ์‹œ๋„ํ•ด๋ณธ๊ฒƒ์€ ๋„ค์ด๋ฐ์˜ ๋ฌธ์ œ๊ฐ€ ์•„๋‹๊นŒ ํ•˜์—ฌ list_notice ์˜ ๋„ค์ž„์„ ์ž„์˜๋กœ abc๋กœ ๋ณ€๊ฒฝํ•˜์—ฌ ์ง„ํ–‰ํ•ด๋ณด์•˜์œผ๋‚˜ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ๋™์ผํ•œ ์˜ค๋ฅ˜๊ฐ€ ๋‚ฌ๋‹ค
  • ๋„ค์ด๋ฐ ๋ฌธ์ œ๋Š” ์•„๋‹ˆ๋ผ๊ณ  ํŒ๋‹จ, ๊ธฐ์กด์˜ ์ฝ”๋“œ๋ฅผ ์ฃผ์„์ฒ˜๋ฆฌ ํ•œ ์ฑ„ user app์—์„œ ์ง„ํ–‰ํ•œ๊ฒƒ๊ณผ ๊ฐ™์ด ๋™์ผํ•˜๊ฒŒ ์ฝ”๋“œ๋ฅผ ๊ตฌ์„ฑํ•˜์—ฌ ์ง„ํ–‰ ํ•ด๋ณด์•˜๋‹ค
urlpatterns = [
    path('webmaster/', include('webmaster.urls')),
    # path('webmaster/', include(('webmaster.urls','webmaster'), namespace='webmaster')),
]
  • ๊ทธ๋Ÿฌ์ž ๊ธฐ์กด์˜ ์˜ค๋ฅ˜์ฝ”๋“œ๊ฐ€ ์‚ฌ๋ผ์ง€๊ณ  ์ž˜ ์ง„ํ–‰๋˜๋Š” ๊ฒƒ์„ ํ™•์ธํ•˜๊ฒŒ ๋˜์—ˆ๋Š”๋ฐ, ์ƒ๊ฐํ•ด๋ณด๊ฑด๋ฐ” ๋ชจ์ข…์˜ ์ด์œ ๋กœ visual studio์ƒ์˜ ์ผ์‹œ์ ์ธ ์—๋Ÿฌ ํ˜น์€ ์ฝ”๋“œ ์‚ฌ์ด์— ๋ˆˆ์— ๋ณด์ด์ง€ ์•Š๋Š” ๊ณต๋ฐฑ๊ฐ™์€๊ฒƒ์ด ์กด์žฌํ–ˆ์„ ํ™•๋ฅ ์ด ์žˆ์—ˆ๋‹ค ๋ผ๊ณ  ์ž ์ •์ ์œผ๋กœ ๊ฒฐ๋ก ์„ ์ง“๊ณ  ํŠธ๋Ÿฌ๋ธ” ์ŠˆํŒ…์„ ๋งˆ์น˜๊ฒŒ ๋˜์—ˆ๋‹ค

๐Ÿ‘ป๋Š๋‚€์ 

  • ์ดํ‹€๋™์•ˆ ๊ณ ์ƒํ•œ๊ฒƒ ์น˜๊ณ ๋Š” ์‚ฌ์‹ค์ƒ ์™œ ๋ผ? ์—์„œ ์ถœ๋ฐœํ–ˆ๋˜ ํŠธ๋Ÿฌ๋ธ”์ŠˆํŒ…์ด ์ด๊ฑด ๋˜ ์™œ ๋ผ? ๋กœ ๋๋‚˜๊ฒŒ ๋˜์—ˆ๋‹ค, ๊ทธ๋ž˜๋„ ๋ฌธ์ œ๋ฅผ ๋Š์ž„์—†์ด ํŒŒ๊ณ ๋“ค๊ณ  ํ•ด๊ฒฐํ•œ ์šฐ๋ฆฌํŒ€์›์—๊ฒŒ ์นญ์ฐฌํ•ด๐Ÿ’š
profile
ํ•˜๋ฃจ์ข…์ผ ๋ชฝ์ƒ๊ฐ€

0๊ฐœ์˜ ๋Œ“๊ธ€