Parent module adsite.adsiteviews.mainhanlder does not exist
Nick Dong
double.620 at gmail.com
Fri Jan 18 00:25:43 EST 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?
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.
More information about the Python-list
mailing list