I got an error in urls.py and this is my code .Can u please help me to rectify the error. Thank you


The error is : File “C:\Users\BHARATH\projects\myhellowebapp\hellowebapp\urls.py”, line 7, in
url(r’^$’, views.index, name=‘home’),
AttributeError: module ‘collection.views’ has no attribute ‘index’

This is my code:-

from collection import views
from django.conf.urls import url, patterns, include
from django.contrib import admin
from django.views.generic import TemplateView

urlpatterns = [
url(r’^$’, views.index, name=‘home’),
url(r’^things/(?P[-\w]+)/$’, views.thing_detail,
# new line we’re adding!
url(r’^admin/’, admin.site.urls),


Hey there! Sounds like your views.py doesn’t have the index view.

Compare your code here and make sure things match, especially spacing: https://github.com/hellowebbooks/hellowebapp-code/tree/chapter-4 (I am assuming you’re on Chapter 4, you can change chapters by updating the Branch on the button at the upper left!)

If everything looks the same, paste your views.py and urls.py into pastebin.com and send me the link so I can see spacing. :)


Thank you so much. It worked. How to add some styles to that web page to look good with some nice UI like Bootstrap buttons, form etc. Once again thank you for writing the book, which is understandable to anyone.


Hi, I have another issue regarding registration form.How to add styles and padding to it.My form is not looking pretty enough. How to add bootstrap forms to it. I didn’t find out the form details like username in my code. I think those are embedded in Django. How to edit those?

I will add my code and the screenshot of my registration form. Can you please help me with that to look it good with nice styling.


{% extends ‘base.html’ %}
{% block title %}
Registration Form - {{ block.super }}
{% endblock title %}

{% block content %}

&nbsp&nbsp&nbspRegistration Form

{% csrf_token %} {{ form.as_p }} h1 { font-family: cursive; font-size: 24px; font-style: normal; font-variant: normal; font-weight: 500; line-height: 26.4px; } {% endblock content %}


Do you have the second book, Hello Web App: Intermediate Concepts? https://hellowebbooks.com/django-intermediate-concepts

It goes over how to add Bootstrap. :)