Hi,
I want to user Python 3.7 and Django 2.1 in Visual Studio.
I just create a new Django project from Visual Studio. It creates the Python-Django project.
But when I try to run 'createsuperuser' command from command-line on
Visual Studio, I am getting this long error text.
I have the Python 3.7 and Django 2.1 version on my computer so I think It is not about the version.
How can I solve this problem?
Traceback (most recent call last):
File "c:\users\misafir\source\repos\DjangoWebProject7\DjangoWebProject7\manage.py", line 17, in <module>
execute_from_command_line(sys.argv)
File "c:\users\misafir\source\repos\DjangoWebProject7\DjangoWebProject7\env\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "c:\users\misafir\source\repos\DjangoWebProject7\DjangoWebProject7\env\lib\site-packages\django\core\management\__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "c:\users\misafir\source\repos\DjangoWebProject7\DjangoWebProject7\env\lib\site-packages\django\core\management\base.py", line 316, in run_from_argv
self.execute(*args, **cmd_options)
File "c:\users\misafir\source\repos\DjangoWebProject7\DjangoWebProject7\env\lib\site-packages\django\contrib\auth\management\commands\createsuperuser.py", line 59, in execute
return super().execute(*args, **options)
File "c:\users\misafir\source\repos\DjangoWebProject7\DjangoWebProject7\env\lib\site-packages\django\core\management\base.py", line 350, in execute
self.check()
File "c:\users\misafir\source\repos\DjangoWebProject7\DjangoWebProject7\env\lib\site-packages\django\core\management\base.py", line 379, in check
include_deployment_checks=include_deployment_checks,
File "c:\users\misafir\source\repos\DjangoWebProject7\DjangoWebProject7\env\lib\site-packages\django\core\management\base.py", line 366, in _run_checks
return checks.run_checks(**kwargs)
File "c:\users\misafir\source\repos\DjangoWebProject7\DjangoWebProject7\env\lib\site-packages\django\core\checks\registry.py", line 71, in run_checks
new_errors = check(app_configs=app_configs)
File "c:\users\misafir\source\repos\DjangoWebProject7\DjangoWebProject7\env\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "c:\users\misafir\source\repos\DjangoWebProject7\DjangoWebProject7\env\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver
return check_method()
File "c:\users\misafir\source\repos\DjangoWebProject7\DjangoWebProject7\env\lib\site-packages\django\urls\resolvers.py", line 396, in check
for pattern in self.url_patterns:
File "c:\users\misafir\source\repos\DjangoWebProject7\DjangoWebProject7\env\lib\site-packages\django\utils\functional.py", line 37, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "c:\users\misafir\source\repos\DjangoWebProject7\DjangoWebProject7\env\lib\site-packages\django\urls\resolvers.py", line 533, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "c:\users\misafir\source\repos\DjangoWebProject7\DjangoWebProject7\env\lib\site-packages\django\utils\functional.py", line 37, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "c:\users\misafir\source\repos\DjangoWebProject7\DjangoWebProject7\env\lib\site-packages\django\urls\resolvers.py", line 526, in urlconf_module
return import_module(self.urlconf_name)
File "C:\Python\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File ".\DjangoWebProject7\urls.py", line 23, in <module>
django.contrib.auth.views.login,
AttributeError: module 'django.contrib.auth.views' has no attribute 'login'
django.contrib.auth.views.login has been removed in django 2.1. From the Release notes:
contrib.auth.views.login(), logout(), password_change(), password_change_done(), password_reset(), password_reset_done(), password_reset_confirm(), and password_reset_complete() are removed.
You should now use the class-based view django.contrib.auth.views.LoginView in your urls, e.g. in its simplest form:
path('login/', LoginView.as_view()),
module 'django.contrib.auth.views' has no attribute 'login'
the error is clearly showing....
i hope you are using Authentication Module that why you are facing this
It looks like you are using windows OS. From the traceback error I can see that you have not correctly installed django. Try creating a virtual environment for every project you create and install django there. It is a best developer practise.
This will clear you issue i hope so.
Cheers :)
Related
I'm trying to get my local Windows 10 PC up and running with my Django application. I'm a novice at Python and Django. My app was written by another developer who's been very helpful and has limited availability. I also want to sort it out myself for learning purposes.
I downloaded my code from Bitbucket and loaded all of the packages in the base.txt and development.txt files onto my Windows 10 PC. I keep getting several errors when trying to run the server.
App is using in the following:
Python 3.61
Django 1.11.3
base.txt file:
boto3==1.4.7
celery==4.1.0
click==6.7
dateutils==0.6.6
Django==1.11.3
django-anymail==0.11.1
django-cors-headers==2.1.0
django-countries==5.0
django-filter==1.0.4
django-solo==1.1.3
django-storages==1.6.5
djangorestframework==3.6.3
djoser==0.6.0
kombu==4.1.0
mysqlclient==1.3.10
Pillow==4.3.0
python-dotenv==0.6.4
python-magic==0.4.13
pytz==2017.2
redis==2.10.6
uWSGI==2.0.15
xlrd==1.2.0
I don't get any errors loading the packages; however, when I run the server I get this screenful of error messages:
(venv) C:\Users\romph\dev\EWO-DEV\backend>python manage.py runserver
Performing system checks...
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x000002A64687E0D0>
Traceback (most recent call last):
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\utils\autoreload.py", line 227, in wrapper fn(*args, **kwargs)
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run self.check(display_num_errors=True)
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\core\management\base.py", line 359, in check include_deployment_checks=include_deployment_checks,
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\core\management\base.py", line 346, in _run_checks return checks.run_checks(**kwargs)
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\core\checks\registry.py", line 81, in run_checks new_errors = check(app_configs=app_configs)
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\core\checks\urls.py", line 16, in check_url_config return check_resolver(resolver)
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\core\checks\urls.py", line 26, in check_resolver return check_method()
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\urls\resolvers.py", line 254, in check for pattern in self.url_patterns:
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\utils\functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\urls\resolvers.py", line 405, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\utils\functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\urls\resolvers.py", line 398, in urlconf_module return import_module(self.urlconf_name)
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "C:\Users\romph\dev\EWO-DEV\backend\ewo\urls.py", line 51, in <module> url(r"^api/", include("apps.accounts.urls", namespace="accounts")),
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\django\conf\urls\__init__.py", line 50, in include urlconf_module = import_module(urlconf_module)
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "C:\Users\romph\dev\EWO-DEV\backend\apps\accounts\urls.py", line 5, in <module> from . import views
File "C:\Users\romph\dev\EWO-DEV\backend\apps\accounts\views.py", line 23, in <module> from .serializers import (
File "C:\Users\romph\dev\EWO-DEV\backend\apps\accounts\serializers.py", line 6, in <module> from apps.company.serializers import EmployeeSerializer
File "C:\Users\romph\dev\EWO-DEV\backend\apps\company\serializers.py", line 18, in <module> from apps.common.serializers import YesOrNoField
File "C:\Users\romph\dev\EWO-DEV\backend\apps\common\serializers.py", line 10, in <module> from .validators import CSVValidator, DocumentValidator
File "C:\Users\romph\dev\EWO-DEV\backend\apps\common\validators.py", line 6, in <module> import magic
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\magic\__init__.py", line 209, in <module> libmagic = loader.load_lib()
File "C:\Users\romph\.pyenv\pyenv-win\versions\3.6.1\lib\site-packages\magic\loader.py", line 49, in load_lib raise ImportError('failed to find libmagic. Check your installation')
That last line gives a pretty good clue.
Visit https://pypi.org/project/python-magic/
and follow the steps for Windows.
Windows
You'll need DLLs for libmagic. #julian-r maintains a pypi
package with the DLLs ...
You likely need to
pip install python-magic-bin
The requirements may have been specific to another os.
Having issues running django site with python3 manage.py runserver command. When starting, I get an error below:
MacBook-Pro-Lev:mysite levpolomosnov$ python3 manage.py runserver
Performing system checks...
Unhandled exception in thread started by <function check_errors.
<locals>.wrapper at 0x10deb92f0>
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 124, in inner_run
self.check(display_num_errors=True)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/base.py", line 359, in check
include_deployment_checks=include_deployment_checks,
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/base.py", line 346, in _run_checks
return checks.run_checks(**kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/checks/urls.py", line 16, in check_url_config
return check_resolver(resolver)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/checks/urls.py", line 26, in check_resolver
return check_method()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/urls/resolvers.py", line 256, in check
for pattern in self.url_patterns:
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/urls/resolvers.py", line 407, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/urls/resolvers.py", line 400, 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 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "/Users/levpolomosnov/Documents/mysite/mysite/urls.py", line 23, in <module>
from django.urls import include, path
ImportError: cannot import name 'include'
From django 2.0, include has been moved to django.urls. If you are using older django versions, then it might throw error. Please see the change log form django 2.0 regarding this issue.
I'm running wagtail in a virtualenvwrapper on my machine. The requirements all install as needed
Django>=2.0,<2.1
wagtail>=2.0,<2.1
I've even started this process over again by completely uninstalling django and wagtail. After reinstall wagtail, I run wagtail start mysite, cd into my directory and run python manage.py migrate. This is what I see:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
utility.execute()
File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/core/management/base.py", line 332, in execute
self.check()
File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/core/management/base.py", line 364, in check
include_deployment_checks=include_deployment_checks,
File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 58, in _run_checks
issues.extend(super()._run_checks(**kwargs))
File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/core/management/base.py", line 351, in _run_checks
return checks.run_checks(**kwargs)
File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/core/checks/registry.py", line 73, in run_checks
new_errors = check(app_configs=app_configs)
File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique
all_namespaces = _load_all_namespaces(resolver)
File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces
url_patterns = getattr(resolver, 'url_patterns', [])
File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/utils/functional.py", line 36, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/johnbriggs/.virtualenvs/wagtail/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/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/utils/functional.py", line 36, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/django/urls/resolvers.py", line 529, in urlconf_module
return import_module(self.urlconf_name)
File "/Users/johnbriggs/.virtualenvs/wagtail/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/johnbriggs/Sites/wagtail/farts/farts/urls.py", line 5, in <module>
from wagtail.admin import urls as wagtailadmin_urls
File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/wagtail/admin/urls/__init__.py", line 13, in <module>
from wagtail.admin.api import urls as api_urls
File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/wagtail/admin/api/urls.py", line 6, in <module>
from .endpoints import PagesAdminAPIEndpoint
File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/wagtail/admin/api/endpoints.py", line 3, in <module>
from wagtail.api.v2.endpoints import PagesAPIEndpoint
File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/wagtail/api/v2/endpoints.py", line 9, in <module>
from rest_framework.renderers import BrowsableAPIRenderer, JSONRenderer
File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/rest_framework/renderers.py", line 25, in <module>
from rest_framework import VERSION, exceptions, serializers, status
File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/rest_framework/exceptions.py", line 17, in <module>
from rest_framework.utils.serializer_helpers import ReturnDict, ReturnList
File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/rest_framework/utils/serializer_helpers.py", line 9, in <module>
from rest_framework.compat import unicode_to_repr
File "/Users/johnbriggs/.virtualenvs/wagtail/lib/python3.6/site-packages/rest_framework/compat.py", line 26, in <module>
from django.core.urlresolvers import ( # Will be removed in Django 2.0
ModuleNotFoundError: No module named 'django.core.urlresolvers'
I haven't added in any custom code.. this is a from-the-start installation. What is causing this error?
It turns out that djangorestframework was an older version. It was most definitely not a duplicate of the question suggested but I was able to solve it by upgrading my version (as suggested by #Alexy). I'm leaving this up in case someone else has a similar issue.
I have problem with running Django tutorial.
I'm new with command-line stuff but I've really searched for my issue and try everything before I post this.
I've tried tutorial with pools application and I've run 'runserver' before and it worked at beginning (Django default page). When I added urls.py (just like in tutorial) it wasn't worked anymore.
I've figired out the problem was different versions of Python (2.7, 3.1, 3.5), so I uninstall all of them and install only the Python 3.5.
There were some minor problems with permission but I've runned terminal as administrator and seemed to be ok. But now I cannot do 'runserver' anymore.
When I type:
C:\Users\urszulka\PycharmProjects\DJ\mysite>python manage.py runserver
I've got:
Performing system checks...
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x039A5858>
Traceback (most recent call last):
File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\core\management\commands\runserver.py", line 116, in inner_run
self.check(display_num_errors=True)
File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\core\management\base.py", line 426, in check
include_deployment_checks=include_deployment_checks,
File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\core\checks\registry.py", line 75, in run_checks
new_errors = check(app_configs=app_configs)
File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver
for pattern in resolver.url_patterns:
File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\utils\functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\core\urlresolvers.py", line 417, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\utils\functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Program Files (x86)\Python35-32\lib\site-packages\django\core\urlresolvers.py", line 410, in urlconf_module
return import_module(self.urlconf_name)
File "C:\Program Files (x86)\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:\Users\urszulka\PycharmProjects\DJ\mysite\mysite\urls.py", line 1
pythjo`"""mysite URL Configuration
^
SyntaxError: invalid syntax
Why syntax error? I've done everything like before.
I'll be really pleased with your help.
You have typos in file DJ\mysite\mysite\urls.py. Looks like the line 1 was scrambled because you type something random like pythjo and that's not valid python syntax.
I'm setting up a Django Framework and I am doing so, using this Tutorial: https://docs.djangoproject.com/en/1.9/intro/tutorial01/. And before that I used this Tutorial to get started: https://docs.djangoproject.com/en/1.9/howto/windows/
I am basically done with the page, and when I run the last command 'python manage.py runserver' in the commandline it get a long error list, see below.
I have repeated the tutorial for about 3 times, and I installed django in my normal python enviroment and in the virtual environment. I ran 'python manage.py runserver' in every possible folder. - but I does not work. Can somebody tell me where I went wrong?
Microsoft Windows [Version 10.0.10586]
(c) 2015 Microsoft Corporation. Alle Rechte vorbehalten.
C:\Users\Johanna>cd Envs\mysite
C:\Users\Johanna\Envs\mysite>python manage.py runserver
Performing system checks...
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x03A6F198>
Traceback (most recent call last):
File "C:\Program Python\Python35-32\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "C:\Program Python\Python35-32\lib\site-packages\django\core\management\commands\runserver.py", line 116, in inner_run
self.check(display_num_errors=True)
File "C:\Program Python\Python35-32\lib\site-packages\django\core\management\base.py", line 426, in check
include_deployment_checks=include_deployment_checks,
File "C:\Program Python\Python35-32\lib\site-packages\django\core\checks\registry.py", line 75, in run_checks
new_errors = check(app_configs=app_configs)
File "C:\Program Python\Python35-32\lib\site-packages\django\core\checks\urls.py", line 10, in check_url_config
return check_resolver(resolver)
File "C:\Program Python\Python35-32\lib\site-packages\django\core\checks\urls.py", line 19, in check_resolver
for pattern in resolver.url_patterns:
File "C:\Program Python\Python35-32\lib\site-packages\django\utils\functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Program Python\Python35-32\lib\site-packages\django\core\urlresolvers.py", line 417, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "C:\Program Python\Python35-32\lib\site-packages\django\utils\functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Program Python\Python35-32\lib\site-packages\django\core\urlresolvers.py", line 410, in urlconf_module
return import_module(self.urlconf_name)
File "C:\Program 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:\Users\Johanna\Envs\mysite\mysite\urls.py", line 20, in <module>
url(r'^polls/', include('polls.urls')),
NameError: name 'include' is not defined
Make sure your code in C:\Users\Johanna\Envs\mysite\mysite\urls.py is completely same as this
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^polls/', include('polls.urls')),
url(r'^admin/', admin.site.urls),
]
Especially, make sure that you have the top one line from django.conf.urls import include, url