Parent module adsite.adsiteviews.mainhanlder does not exist

Nick Dong double.620 at
Fri Jan 18 06:25:43 CET 2013

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?

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({
    t = loader.get_template('users.html')

    return HttpResponse(t.render(c))

copied file:

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)

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.

More information about the Python-list mailing list