Django - Import Error: No module named *.urls

后端 未结 2 1978
耶瑟儿~
耶瑟儿~ 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:19

    If taco is the name of the project check that apps are being referenced correctly so in your installed apps you may need the following:

    Installed Applications:
    ('django.contrib.admin',
     'django.contrib.auth',
     'django.contrib.contenttypes',
     'django.contrib.sessions',
     'django.contrib.messages',
     'django.contrib.staticfiles',
     'south',
     'customers',
     'inventory',
     'lookups',
     'orders')
    
    0 讨论(0)
  • 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',
    )
    
    0 讨论(0)
提交回复
热议问题