I am trying to understand why my Django project is saying that it cannot understand my paths. According the instructions of the book django for beginners I need to run the python manage.py runserver command to load the website but it stops me.
It shows the following when I get the error:
Error Message
(.venv) andrewstribling@Andrews-MBP pages % python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
Traceback (most recent call last):
File "/Users/andrewstribling/Desktop/code/pages/manage.py", line 22, in <module>
main()
File "/Users/andrewstri
(.venv) andrewstribling@Andrews-MBP pages % python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
Traceback (most recent call last):
File "/Users/andrewstribling/Desktop/code/pages/manage.py", line 22, in <module>
main()
File "/Users/andrewstribling/Desktop/code/pages/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
utility.execute()
File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/core/management/__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/core/management/base.py", line 412, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/core/management/commands/runserver.py", line 74, in execute
super().execute(*args, **options)
File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/core/management/base.py", line 458, in execute
output = self.handle(*args, **options)
File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/core/management/commands/runserver.py", line 111, in handle
self.run(**options)
File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/core/management/commands/runserver.py", line 118, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/utils/autoreload.py", line 671, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/utils/autoreload.py", line 660, in start_django
reloader.run(django_main_thread)
File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/utils/autoreload.py", line 343, in run
autoreload_started.send(sender=self)
File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/dispatch/dispatcher.py", line 176, in send
return [
File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/dispatch/dispatcher.py", line 177, in <listcomp>
(receiver, receiver(signal=self, sender=sender, **named))
File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/template/autoreload.py", line 43, in watch_for_template_changes
for directory in get_template_directories():
File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/template/autoreload.py", line 20, in get_template_directories
items.update(cwd / to_path(dir) for dir in backend.engine.dirs if dir)
File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/template/autoreload.py", line 20, in <genexpr>
items.update(cwd / to_path(dir) for dir in backend.engine.dirs if dir)
File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/utils/_os.py", line 61, in to_path
raise TypeError("Invalid path type: %s" % type(value).__name__)
TypeError: Invalid path type: list
django_Project urls.py
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path("admin/", admin.site.urls),
path("", include("pages.urls")),
]
pages urls.py
from django.shortcuts import render
from django.views.generic import TemplateView
# Create your views here.
class HomePageView(TemplateView):
template_name = "home.html"
settings.py
` ```
INSTALLED_APPS = [
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"pages",
]
views.py
from django.shortcuts import render
from django.views.generic import TemplateView
# Create your views here.
class HomePageView(TemplateView):
template_name = "home.html"
What steps have I tried and what am I expecting?
I have tried moving my folders around, I have tried restarting and running the same commands again. I have tried searching on stackoverflow for articles related to the subject. I have tried checking the python documentation.
Could my file directory have something to do with this?
I am at a loss because my path is in a and thats what url patterns are supposed to be in.
Any ideas?