0
votes

Trying the python crash course web app project. Python manage.py runserver is throwing off a bunch of errors

Exception in thread django-main-thread: Traceback (most recent call last): File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner self.run() File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 865, in run self._target(*self._args, **self._kwargs) File "/Users/me/Pictures/Python/learning_log/ll_env/lib/python3.7/site-packages/django/utils/autoreload.py", line 54, in wrapper fn(*args, **kwargs

I figured it out actually, but not sure why or how it works, but decided to leave it here in case someone comes across the same problem in the future.

In the urls.py file, the textbook tells you to add

"url(r'', include('learning_logs.urls', namespace='learning_logs')),"

what fixes it is adding this instead of the above,

"path('', include('learning_logs.urls'), name='learning_logs'),"

'''
python manage.py runserver
'''
1
error code was: Exception in thread django-main-thread: Traceback (most recent call last): File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner self.run() File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 865, in run self._target(*self._args, **self._kwargs) File "/Users/me/Pictures/Python/learning_log/ll_env/lib/python3.7/site-packages/django/utils/autoreload.py", line 54, in wrapper fn(*args, **kwargs)nick lin
You didn't tell us which crash course you're doing. But the reason is that probably your course assumes a prior version of Django (1.8 or 1.11) and you installed the latest (2.2). Your version wants to see a path whereas previous versions of Django used url. Always check when following a tutorial, which version of python and Django they assume.dirkgroten
In cases where you figured out the problem but want to leave the solution for others to improve upon or to help others with the same problem consider answering your own question @nick lin.Trevor Reid
Ah, yep. @dirkgroten I think you're right. Thanks!nick lin

1 Answers

0
votes

What solved my problem was: using this line instead of the one from the textbook

"path('', include('learning_logs.urls'), name='learning_logs'),"