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