This article discuss on how to solve the error specified in the title part. The error message is being encountered upon executing a specific URL so that the page which is going to be accessed is properly presented. The page is powered by Django framework which is actually the core of the web-based application. The error message can be found as follows :
NoReverseMatch: Reverse for 'url_name' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
The error message itself presented accordingly which means the context vary depends on the application’s url settings. The error part, the ‘url_name’ can be vary from one another, where it is actually the main problem which generates the error message.
It can be concluded from the error message that the ‘url_name’ cannot be found so it cannot render the page which is represented by the ‘url_name’ properly. It is actually representing the name of the url which is normally defined in a file named urls.py. Below is the possible location of ‘urls.py’ which must be repaired or searched for solving the error message :
user@hostname:~/project/apps/apps$ tree -L 2 . ├── db.sqlite3 ├── apps │ ├── __init__.py │ ├── __init__.pyc │ ├── roles.py │ ├── settings.py │ ├── settings.pyc │ ├── urls.py │ ├── urls.pyc │ ├── wsgi.py │ └── wsgi.pyc
The file named urls.py, and it must be checked in the file whether the ‘url_name’ is defined properly. Below is the content of the file :
"""apps URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf import settings from django.conf.urls.static import static from django.conf.urls import url, include from django.contrib import admin from module import views as module_views urlpatterns = [ url(r'^admin/', admin.site.urls, name='admin'), url(r'^$', main_views.index, name='index'), url(r'^myurl/', module_views.index, name='url_name'), url(r'^home/', main_views.home, name='home'),
As shown in the above content of urls.py file, it must be :
url(r'^myurl/', module_views.index, name='url_name'),
Where the above line is suspected to become the culprit of the problem. Figure it out what’s wrong with that line or just easily erase it.