I was attempting the tutorial titled "Writing your first Django app". The tutorial appears to be very simple, but it does not seem to work. I have frustrated myself by attempting to do it from scratch after failing last week. If I could get this app to work I could fix the tutorial for you. It looks like a lot of people have similar gripes about the directions not working.
-- I get errors like ModuleNotFoundError: No module named 'polls'
my directory structure looks like this :
/home/me/parent/mysite/
db.sqlite3
manage.py
mysite/
/home/me/parent/mysite/mysite/
__init__.py
polls/
settings.py
urls.py
wsgi.py
the content of urls.py is :
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^polls/', include('polls.urls')),
url(r'^admin/', admin.site.urls),
]
/home/me/parent/mysite/mysite/polls/
__init__.py
admin.py
apps.py
migrations
models.py
tests.py
urls.py
views.py
the content of urls.py is :
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
]
the content of views.py is :
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def index(request):
return HttpResponse("Hello, Mothers Fuckers! You're at the polls index!")
So can somebody please tell me why I get ModuleNotFoundError: No module named 'polls'.
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/09c07d79-bcbf-4451-9d73-9d7189e66dfc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment