I am wtahcing a very nice video to start with Django. But I observed a problem of version.
The video was published in 2015 (Aïe)
The video shows how to modify the router.
For exemple, the teacher add the following:
The problem, in the last django version it starts with path and I did the following, after path(‘admin/’…
path('admin/', admin.site.urls), path('/', 'contacts.views.index.page'),
It does not work. When I run runserver, I got a such error
res = instance.dict[self.name] = self.func(instance)
File “/home/pierrot/ecosensors/env-console/lib/python3.6/site-packages/django/urls/resolvers.py”, line 595, in urlconf_module
File “/usr/lib/python3.6/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “< frozen importlib._bootstrap >”, line 994, in _gcd_import
File “< frozen importlib._bootstrap >”, line 971, in _find_and_load
File “< frozen importlib._bootstrap >”, line 955, in _find_and_load_unlocked
File “< frozen importlib._bootstrap >”, line 665, in _load_unlocked
File “< frozen importlib._bootstrap_external >”, line 678, in exec_module
File “< frozen importlib._bootstrap >”, line 219, in _call_with_frames_removed
File “/home/pierrot/ecosensors/pjtconsole/urls.py”, line 21, in
File “/home/pierrot/ecosensors/env-console/lib/python3.6/site-packages/django/urls/conf.py”, line 73, in _path
raise TypeError(‘view must be a callable or a list/tuple in the case of include().’)
TypeError: view must be a callable or a list/tuple in the case of include().
(I am a bit surpise to see something about bootstrap)
I beleive, the video is very nice but not up to date :).
What is now the correct way and path to re-route, the root to a view of my app?
Thanks a lot for your help