KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm new to Django and working my way through "The Django Book" by Holovaty and Kaplan-Moss. I have a project called "mysite" that contains two applications called "books" and "contact." Each has its own view.py file. In my urls.py file I have the following: from books import views from contact import views ... urlpatterns = patterns('', ... (r'^search/$', views.search), (r'^contact/$', views.contact), ... When I run my code I get this error: NameError at /search/ ... Exception value: 'module' object has no attribute 'search' What I believe is happening is that since views from contact was imported last, Django is looking at contact's view which does not contain search (search is in books' view). What is the proper way to import the views.py file from two distinct applications within a Django urls file? Thanks for your help!
Tags (comma-separated)
Save Edits
Cancel