سؤال

I apologise for yet another simple Django question but I cannot find what I'm after.

Project: footystats
App: stats

What I'm trying to do is defer all URL mapping to the app so I have url.py in footystats which contains the following:

    ..
    urlpatterns = patterns('',
                           url(r'^', include(stats.urls), namespace = 'stats')
    )
    ..

When I try to open the main page I get the following error:

NameError at /main/

name 'stats' is not defined

Request Method: GET
Request URL: redacted/main/
Django Version: 1.6.1
Exception Type: NameError
Exception Value: name 'stats' is not defined

Exception Location: c:\django\footystats\footystats\urls.py in , line 8
Python Executable: C:\Python27\python.exe
Python Version: 2.7.6
Python Path: ['c:\django\footystats',
'C:\Python27\Lib\site-packages\django',
'C:\Windows\system32\python27.zip',
'C:\Python27\DLLs',
'C:\Python27\lib',
'C:\Python27\lib\plat-win',
'C:\Python27\lib\lib-tk',
'C:\Python27',
'C:\Python27\lib\site-packages']

Is this enough to go on? Do you need more information?

Thanks

هل كانت مفيدة؟

المحلول

Have you imported stats yet? if not you can import it or change stats.urls for 'stats.urls'

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top