2022-10-31發表Django幾秒讀完 (大約51個字)(Django)取得目前URL/app_name12345678from django.urls import resolvedef get_current_url(request): ... current_url = resolve(request.path_info).url_name app_name = resolve(request.path_info).app_name print("current_url: %s" % current_url) print("app_name: %s" % app_name)在template取得app_name1{{request.resolver_match.app_name}}#Django