﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
27075	URLconf does not properly import underscore-containing module identifiers	Peter Lai	nobody	"If I have the following {{{ mysite\myapp\urls.py}}}:
{{{#!python
from django.conf.urls import url

from my_app import views, other_views

urlpatterns = [
    url(r'^$, views.index, name='index'), # OK
    url(r'^foo/', other_views.bar, name='getfoo'),
]
}}}

and in {{{ other_views.py}}}:
{{{#!python
def bar(request):
    pass
}}}

This results in {{{ manage.py}}} raising:

{{{
File ""C:\path\to\django_sites\mysite\mysite\urls.py"", line 21, in <module>
    url(r'^myapp/', include('myapp.urls')),
File ""C:\path\to\py3_venv\django1\lib\site-packages\django\conf\urls\__init__.py"", line 50, in include
    urlconf_module = import_module(urlconf_module)
  File ""C:\path\to\py3_venv\django1\lib\importlib\__init__.py"", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File ""<frozen importlib._bootstrap>"", line 2254, in _gcd_import
  File ""<frozen importlib._bootstrap>"", line 2237, in _find_and_load
  File ""<frozen importlib._bootstrap>"", line 2226, in _find_and_load_unlocked
  File ""<frozen importlib._bootstrap>"", line 1200, in _load_unlocked
  File ""<frozen importlib._bootstrap>"", line 1129, in _exec
  File ""<frozen importlib._bootstrap>"", line 1471, in exec_module
  File ""<frozen importlib._bootstrap>"", line 321, in _call_with_frames_removed
File ""C:\path\to\django_sites\mysite\myapp\urls.py"", line 15, in <module>
    other_views.bar, name='getfoo'),
AttributeError: 'module' object has no attribute 'bar'
}}}

Note that {{{mysite\myapp\urls.py}}} is included via the {{{mysite\mysite\urls.py}}}

Renaming {{{other_views.py}}} to {{{otherviews.py}}} fixes the problem. Platform: Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)] on win32."	Bug	closed	Core (URLs)	1.10	Normal	worksforme	underscore, import		Unreviewed	0	0	0	0	0	0
