강의로 돌아가기
-

NameError

오류가 이렇게 뜨네요 분명히 elections라 했는데...
File C:\Users\joshu_000\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\utils\autoreload.py, line
226, in wrapper
fn(args, *kwargs)
File C:\Users\joshu_000\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\management\commands\r
unserver.py
, line 116, in innerrun
self.check(display
numerrors=True)
File "C:\Users\joshu
000\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\management\base.py,
line 426, in check
include_deployment_checks=include_deployment_checks,
File
C:\Users\joshu000\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\checks\registry.py",
line 75, in run
checks
newerrors = check(appconfigs=appconfigs)
File "C:\Users\joshu
000\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\checks\urls.py, line
13, in check_url_config
return check_resolver(resolver)
File
C:\Users\joshu000\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\checks\urls.py", line
23, in check
resolver
for pattern in resolver.urlpatterns:
File "C:\Users\joshu
000\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\utils\functional.py, line
33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File
C:\Users\joshu000\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\urlresolvers.py", lin
e 417, in url
patterns
patterns = getattr(self.urlconfmodule, urlpatterns, self.urlconfmodule)
File C:\Users\joshu_000\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\utils\functional.py, line
33, in get
res = instance.dict[self.name] = self.func(instance)
File C:\Users\joshu_000\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\urlresolvers.py, lin
e 410, in urlconfmodule
return import
module(self.urlconfname)
File "C:\Users\joshu
000\AppData\Local\Programs\Python\Python35-32\lib\importlib_init.py", line 126, in importmod
ule
return bootstrap.gcdimport(name[level:], package, level)
File "<frozen importlib.
bootstrap>, line 986, in _gcd_import
File
, line 969, in _find_and_load
File
, line 958, in _find_and_load_unlocked
File
, line 673, in _load_unlocked
File
, line 662, in exec_module
File
, line 222, in _call_with_frames_removed
File
C:\Users\joshu_000\mysite\mysite\urls.py", line 5, in
url(r'',include(elections.urls)),
NameError: name 'elections' is not defined

1 개의 답변
정찬형

C:\Users\joshu_000\mysite\mysite\urls.py

코드에 오타가 있는거 같네요.
mysite 폴더 내부의 urls.py 에서

 url(r'^', include(elections.urls)),

라고 적으신거 아닌가요?

url(r'^', include('elections.urls')),

따옴표가 빠졌는지 확인해주세요.

답변 쓰기
이 입력폼은 마크다운 문법을 지원합니다. 마크다운 가이드 를 참고하세요.