Stuck at Tutorial 1

47 views
Skip to first unread message

Zhou Sicong

unread,
Feb 1, 2017, 7:32:58 AM2/1/17
to django...@googlegroups.com
Hi, 

  I tried doing exactly everything as told in Tutorial 1 (https://docs.djangoproject.com/en/1.10/intro/tutorial01/)
  I use idle to write the polls.py and urls.py
  Do i totally overwrite the code already in those file or leave them alone and add on the codes in the tutorial. 

  Because i always get this when i start run the server again. What could possibly be the error?



Performing system checks...

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x03C7D978>
Traceback (most recent call last):
  File "c:\django\django\utils\autoreload.py", line 226, in wrapper
    fn(*args, **kwargs)
  File "c:\django\django\core\management\commands\runserver.py", line 125, in inner_run
    self.check(display_num_errors=True)
  File "c:\django\django\core\management\base.py", line 356, in check
    include_deployment_checks=include_deployment_checks,
  File "c:\django\django\core\management\base.py", line 343, in _run_checks
    return checks.run_checks(**kwargs)
  File "c:\django\django\core\checks\registry.py", line 78, in run_checks
    new_errors = check(app_configs=app_configs)
  File "c:\django\django\core\checks\urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "c:\django\django\core\checks\urls.py", line 23, in check_resolver
    return check_method()
  File "c:\django\django\urls\resolvers.py", line 247, in check
    for pattern in self.url_patterns:
  File "c:\django\django\utils\functional.py", line 31, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "c:\django\django\urls\resolvers.py", line 398, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "c:\django\django\utils\functional.py", line 31, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "c:\django\django\urls\resolvers.py", line 391, in urlconf_module
    return import_module(self.urlconf_name)
  File "C:\Users\SzeChong\AppData\Local\Programs\Python\Python35-32\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 662, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "C:\mysite\mysite\urls.py", line 20, in <module>
    url(r'^polls/', include('polls.urls')),
  File "c:\django\django\conf\urls\__init__.py", line 39, in include
    urlconf_module = import_module(urlconf_module)
  File "C:\Users\SzeChong\AppData\Local\Programs\Python\Python35-32\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 658, in exec_module
  File "<frozen importlib._bootstrap_external>", line 764, in get_code
  File "<frozen importlib._bootstrap_external>", line 724, in source_to_code
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "C:\mysite\polls\urls.py", line 1
    Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:38:48) [MSC v.1900 32 bit (Intel)] on win32
             ^
SyntaxError: invalid syntax

ludovic coues

unread,
Feb 1, 2017, 7:54:40 AM2/1/17
to django...@googlegroups.com
Sharing the contents of polls/urls.py could help but I assume you didn't make any errors on the first line. To be sure, you can add a comment on the first line and leave the second line blank.
If you still have an error on line 1, it might be related to how you save your file. Python might not like utf8 with BOM. 

I hope that helps you

--
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...@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/CAF_57Gsq7nM5bJNGhhdoomQV9ywJ6pN5AgOfdGVYXe2jzFn4sg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Nibil M S

unread,
Feb 1, 2017, 7:54:44 AM2/1/17
to django-users, django...@googlegroups.com
There is some syntax error in the file. Please ensure that your file is following python syntax. I hope you know basics of python.


---- On Wed, 01 Feb 2017 13:17:39 +0530 Zhou Sicong <genie...@gmail.com> wrote ----

--
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...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages