urlconf include + redirect 구현 방법 # ROOT urls.py from django.conf.urls.defaults import * urlpatterns = patterns(, (rexample/, include(apps.example.urls) ), (ruser_config/, include(apps.user_config.urls) ), (rdemo/, include(apps.game.urls) ), (r$, django.views.generic.simple.redirect_to, { url: /demo/ }), ) # 자식 urls.py from django.conf.urls.defaults import * from django.views.generic.simple import direct_to_template urlpatterns = patterns(apps.example.views, (rcustom_map/$, custom_map_page), (r$, index_page), ) 요약 - urlconf 에서 문자열로 바인딩할 때, ROOT 이든 하위 app 이든, 모듈 경로는 절대 경로여야 한다. - 문자열 모듈들은 from import 로 축약되지 않는다. - redirect_to 의 경우에도 문자열이므로 절대 경로 써야 한다. - 하위 모듈이 들어가 있는 폴더에는 무조건 init.py 넣을 것. - 부모 urls.py 에서 include 할 때 $ 없어야 함 - 단, 하위 app urls.py 에서는 ^$ 사용해야 한다. - 무조건 모든 폴더 경로에 / 를 넣으면 있든 없든 장고가 알아서 해준다.