Getting this error with running django server

467 views
Skip to first unread message

python stories

unread,
Feb 8, 2020, 8:48:57 AM2/8/20
to Django users
C:\Users\user\PycharmProjects\pyshop>py manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "C:\Python38\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "C:\Python38\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Python38\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper
    fn(*args, **kwargs)
  File "C:\Python38\lib\site-packages\django\core\management\commands\runserver.py", line 11
7, in inner_run
    self.check(display_num_errors=True)
  File "C:\Python38\lib\site-packages\django\core\management\base.py", line 392, in check
    all_issues = self._run_checks(
  File "C:\Python38\lib\site-packages\django\core\management\base.py", line 382, in _run_che
cks
    return checks.run_checks(**kwargs)
  File "C:\Python38\lib\site-packages\django\core\checks\registry.py", line 72, in run_check
s
    new_errors = check(app_configs=app_configs)
  File "C:\Python38\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_con
fig
    return check_resolver(resolver)
  File "C:\Python38\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolve
r
    return check_method()
  File "C:\Python38\lib\site-packages\django\urls\resolvers.py", line 407, in check
    for pattern in self.url_patterns:
  File "C:\Python38\lib\site-packages\django\utils\functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Python38\lib\site-packages\django\urls\resolvers.py", line 588, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "C:\Python38\lib\site-packages\django\utils\functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Python38\lib\site-packages\django\urls\resolvers.py", line 581, in urlconf_module

    return import_module(self.urlconf_name)
  File "C:\Python38\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 779, in exec_module
  File "<frozen importlib._bootstrap_external>", line 916, in get_code
  File "<frozen importlib._bootstrap_external>", line 846, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\user\PycharmProjects\pyshop\pyshop\urls.py", line 17
    from django.urls import path path, include
                                 ^
SyntaxError: invalid syntax


Can anyone help me out. Many thanks!

Kasper Laudrup

unread,
Feb 8, 2020, 9:39:43 AM2/8/20
to django...@googlegroups.com
Hi "python stories"

On 08/02/2020 10.43, python stories wrote:
>   File "C:\Users\user\PycharmProjects\pyshop\pyshop\urls.py", line 17
>     from django.urls import path path, include
>                                  ^
> SyntaxError: invalid syntax
>
>
> Can anyone help me out. Many thanks!
>

The error clearly indicates what is wrong. You have a syntax error
because you don't use the correct syntax for importing modules. This was
the best help I could find:

https://www.tutorialspoint.com/How-to-use-multiple-modules-with-Python-import-Statement

This is extremely basic Python knowledge. I suggest you start out by
learning some basic python before diving into Django. Otherwise you'll
spent a lot of time dealing with very basic mistakes like this.

Kind regards,

Kasper Laudrup
Reply all
Reply to author
Forward
0 new messages