Fix Python – Django URLs TypeError: view must be a callable or a list/tuple in the case of include()

After upgrading to Django 1.10, I get the error:
TypeError: view must be a callable or a list/tuple in the case of include().

My urls.py is as follows:
from django.conf.urls import include, url

urlpatterns = [
url(r’^$’, ‘myapp.views.home’),
url(r’^contact/$’, ‘myapp.views.contact’),
url(r’^login/$’, ‘django.contrib.auth.views.login’….

Fix Python – Django URL Redirect

How can I redirect traffic that doesn’t match any of my other URLs back to the home page?
urls.py:
urlpatterns = patterns(”,
url(r’^$’, ‘macmonster.views.home’),
#url(r’^macmon_home$’, ‘macmonster.views.home’),
url(r’^macmon_output/$’, ‘macmonster.views.output’),
url(r’^macmon_about/$’, ‘macmonster.views.about’),
url(r’^.*$’, ….

Fix Python – ImproperlyConfiguredError about app_name when using namespace in include()

I am currently trying out Django. I use the namespace argument in one of my include()s in urls.py. When I run the server and try to browse,
I get this error.
File “C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\conf.py”, line 39, in include
‘Specifying a namespace in include() without providing an app_nam….

Fix Python – Is it better to use path() or url() in urls.py for django 2.0?

In a django online course, the instructor has us use the url() function to call views and utilize regular expressions in the urlpatterns list. I’ve seen other examples on youtube of this.
e.g.
from django.contrib import admin
from django.urls import include
from django.conf.urls import url

urlpatterns = [
path(‘admin/’, admin.site.urls),
….