Useful tips about many users mistakes

Useful tips about many users mistakes

2018, Jan 01    

- app_name error


app_name error happens from django 2.0 or over. Before 2.0 ver, in the urlpattens of project urls.py, you just added namespace in the url().

# project_name/urls.py
urlpatterns = [
    ....
    url(r'^sample/', include('sample.urls', namespace='sample'))
]


And you don’t need to add app_name in other file. but from django ver 2.0, you must add app_name in application urls.py. For instance, according to example above, you must add following line in sample/urls.py (sample is application name).

# sample/urls.py

app_name = 'sample'