I did exactly what is written in the tutorial 1 and checked it many times, and I got the server up and running and I had this log.
The funny thing is that I don't have this log and it starts running the server successfully if I get rid of the path setting in the mysite/urls.py
I think I'm having this issue because of the 'include' statement in this script.
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('polls/', include('polls.urls')),
path('admin/', admin.site.urls),
]
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x104061488>
Traceback (most recent call last):
File "/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 120, in inner_run
self.check(display_num_errors=True)
File "/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/core/management/base.py", line 364, in check
include_deployment_checks=include_deployment_checks,
File "/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/core/management/base.py", line 351, in _run_checks
return checks.run_checks(**kwargs)
File "/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/core/checks/registry.py", line 73, in run_checks
new_errors = check(app_configs=app_configs)
File "/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/core/checks/urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/core/checks/urls.py", line 23, in check_resolver
return check_method()
File "/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/urls/resolvers.py", line 397, in check
for pattern in self.url_patterns:
File "/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/utils/functional.py", line 36, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/urls/resolvers.py", line 536, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/utils/functional.py", line 36, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/urls/resolvers.py", line 529, in urlconf_module
return import_module(self.urlconf_name)
File "/Library/Frameworks/Python.framework/Versions/3.6/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 "/Users/seogiwon/pythonDocuments/djangoTutorial/mysite/mysite/urls.py", line 20, in <module>
path('polls/', include('polls.urls')),
File "/Users/seogiwon/pythonDocuments/djangoTutorial/myvenv/lib/python3.6/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/Library/Frameworks/Python.framework/Versions/3.6/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 "/Users/seogiwon/pythonDocuments/djangoTutorial/mysite/polls/urls.py", line 3, in <module>
from . import views
File "/Users/seogiwon/pythonDocuments/djangoTutorial/mysite/polls/views.py", line 6
def index[request]:
^
SyntaxError: invalid syntax
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d5f947ea-158f-41ca-a1e2-2a128f7b9e22%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment