Parent module adsite.adsiteviews.mainhanlder does not exist

N

Nick Dong

I created a django project using django 1.4.2. There is one 'app'(adsite) in this project. And It works. But when I copied some 'py' files into the 'app' folder, I got "Parent module adsite.adsiteviews.mainhanlder does not exist." Should I register the new files to __init__ in the 'app'? Did new coped files break the "import" rules?

views.py

from django.http import HttpResponse
from django.template import Context, loader
from adsite.models import UserInfo

def showusers(request):
userlist = UserInfo.objects.all()
c = Context({
'userlist':userlist,
})
t = loader.get_template('users.html')

return HttpResponse(t.render(c))

copied file: adsiteviews.py

class mainhanlder(TemplateView)
def get(self):
""" """
variables = {
'user': self.get_current_user(),
'mchosts' : MCHOSTS,
'servers' : servers}

index_templ = tmpl_lookup.get_template("index.html")
body = index_templ.render(**variables)
self.write(body)

urls.py

urlpatterns = patterns('',
# Examples:
url(r'^$', 'adsite.adsiteviews.mainhandler.as_View()'),
url(r'^users/$', 'adsite.views.showusers'),

I have no clues about this problem. any suggestions would be appreciated. thx for your time.
 
J

Jason Friedman

I created a django project using django 1.4.2. There is one 'app'(adsite)in this project. And It works. But when I copied some 'py' files into the 'app' folder, I got "Parent module adsite.adsiteviews.mainhanlder does not exist." Should I register the new files to __init__ in the 'app'? Did new coped files break the "import" rules?

I do not know if this is your problem, and I know little about django,
but is "mainhanlder" a typographical error?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top