Django - Import Error: No module named *.urls

后端 未结 2 1994
耶瑟儿~
耶瑟儿~ 2021-01-05 04:45

I\'m working through the official Django tutorial and adapting it slightly for my own needs using Django version 1.6.1, Python 2.7.6.

I\'m at the point where it has

2条回答
  •  耶瑟儿~
    2021-01-05 05:26

    In your customers/urls.py:

    Change this:

    urlpatterns = ('', 
        url(r'^$', views.index, name='index')
    );
    

    For this:

    urlpatterns = patterns('', 
        url(r'^$', views.index, name='index')
    );
    

    Also, make sure you have your __init__.py file in package customers. And that INSTALLED_APPS is correctly filled with you app name.

    INSTALLED_APPS = (
        'django.contrib.auth',
        'django.contrib.contenttypes',
        'django.contrib.sessions',
        'django.contrib.sites',
        'django.contrib.messages',
        'django.contrib.staticfiles',
        'django.contrib.admin',
        'south',
        'customers',
        'inventory',
        'lookups',
        'orders',
    )
    

提交回复
热议问题