Re: NameError name 'lang' is not defined, corresponds to name 'polls' is not defined,

In your INSTALLED_APPS part in the configuration file, the registered application is called 'langu', and not 'lang'. If you copied your code, that's your problem.



On Sunday, July 6, 2014 2:26:15 AM UTC-5, gintare wrote:
I am trying to create a project "lang" according Django documentation part 1-4 tutorial.

Folder structure:

Scripts\lang\lang\_init_.py
Scripts\lang\lang\settings.py
Scripts\lang\lang\urls.py

Scripts\lang\langu\_init_.py
Scripts\lang\langu\admin.py
Scripts\lang\langu\models.py
Scripts\lang\langu\urlsu.py
Scripts\lang\langu\views.py

************* Scripts\lang\lang\urls.py
from django.conf.urls import patterns, include, url

from django.contrib import admin
admin.autodiscover()

from langu import views

urlpatterns = patterns('',              
    url(r'^langu/', include(langu.urlsu)),                   
    url(r'^admin/', include(admin.site.urls)),
)


************* Scripts\lang\langu\urlsu.py
from django.conf.urls import patterns, url

from langu import views

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


************* Scripts\lang\lang\settings.py
...
INSTALLED_APPS = (
    'django.contrib.admin',
    'langu',
)
ROOT_URLCONF = 'lang.urls'
....




************* Scripts\lang\langu\views.py
from django.shortcuts import render
from django.http import HttpResponse

def index(request):
    return HttpResponse("Hello, world. You're at the poll index.")


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a5d1e185-49e5-44aa-a13b-d496bec66375%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.