Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #36975 > unrolled thread

Parent module adsite.adsiteviews.mainhanlder does not exist

Started byNick Dong <double.620@gmail.com>
First post2013-01-17 21:25 -0800
Last post2013-01-20 07:49 -0700
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Parent module adsite.adsiteviews.mainhanlder does not exist Nick Dong <double.620@gmail.com> - 2013-01-17 21:25 -0800
    Re: Parent module adsite.adsiteviews.mainhanlder does not exist Jason Friedman <jason@powerpull.net> - 2013-01-20 07:49 -0700

#36975 — Parent module adsite.adsiteviews.mainhanlder does not exist

FromNick Dong <double.620@gmail.com>
Date2013-01-17 21:25 -0800
SubjectParent module adsite.adsiteviews.mainhanlder does not exist
Message-ID<1795aead-8260-4f68-9597-a6aa488f6513@googlegroups.com>
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.

[toc] | [next] | [standalone]


#37110

FromJason Friedman <jason@powerpull.net>
Date2013-01-20 07:49 -0700
Message-ID<mailman.704.1358693390.2939.python-list@python.org>
In reply to#36975
> 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?

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web