Error Was No Module Named Views
Contents |
here for a quick overview of the site Help Center Detailed answers to
Importerror At /admin/ No Module Named Views
any questions you might have Meta Discuss the workings and importerror no module named indexes.base pickle policies of this site About Us Learn more about Stack Overflow the company Business Learn more
Django Views
about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community django tutorial Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up ImportError No module named views up vote 1 down vote favorite I am very new to Django. I just configured it and trying to create a simple Hello world! web application. I am following a tutorial step by step. I ran the command python django-admin.py startproject mysite which created mysite directory with another directory called mysite in it along witbh manage.py. The sub directory mysite has init.py init.pyc settings.py settings.pyc urls.py urls.pyc wsgi.py wsgi.pyc. In the outer mysite directory I created views.py which has the following code:- from django.http import HttpResponse def hello(request): return HttpResponse("Hello world!") In the inner mysite directory, in urls.py I have the following code:- from django.conf.urls import patterns, include, url from mysite.views import * urlpatterns = patterns('', url(r'^hello/$', 'mysite.views.hello'), But I am getting this error:- ImportError at /hello/ No module named views Request Method: GET Django Version: 1.6.2 Exception Type: ImportError Exception Value: No module named views Exception Location: /data/aman/mysite/mysite/urls.py in
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. http://stackoverflow.com/questions/22011791/importerror-no-module-named-views Join them; it only takes a minute: Sign up Django - ImportError: No module named views up vote 0 down vote favorite I am developing an application in python 2.7 and using Django, when I run it on my local machine (windows 7) it runs well without any error, but when I try to run it in a virtual http://stackoverflow.com/questions/35697252/django-importerror-no-module-named-views machine with ubuntu server where it also used to work well, it crashes with the following error This is my project working tree: - MYSITE * BMM ·admin.py ·apps.py ·models.py ·pdf_utils.py ·urls.py ·views.py *Mysite ·settings.py ·urls.py ·wsgi.py This is the app\urls.py file: from django.conf.urls import url from wkhtmltopdf.views import PDFTemplateView from . import views urlpatterns = [ url(r'^$', views.index, name='index'), # url(r'^$', views.pdf, name='pdf'), # url(r'^$', views.ganttChart, name='ganttChart'), url(r'^pdf/$', PDFTemplateView.as_view(template_name='billReport.html',filename='my_pdf.pdf'), name='pdf'), url(r'^report/$', views.report, name='report'), ] And this is the mysite/urls.py file: from django.conf.urls import include, url from django.contrib import admin #from wkhtmltopdf.views import PDFTemplateView urlpatterns = [ url(r'',include('bmm.urls')), url(r'^ganttchart/', include('bmm.urls')), url(r'^admin/', admin.site.urls), #url(r'^pdf/$', PDFTemplateView.as_view(template_name='billReport.html', filename='my_pdf.pdf'), name='pdf'), ] Any help about how to solve this would be really appreciated python django python-2.7 share|improve this question asked Feb 29 at 10:30 rpc 52 which django version you are using ? –NiviD Feb 29 at 10:31 just checked and I am using 1.9.1 in the Ubuntu Server machine and 1.9.2 in the W7 machine, could this be the problem? –rpc Feb 29 at
here for a quick overview of the site Help Center http://stackoverflow.com/questions/18921141/django-import-error-in-views-no-module-named-x Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss no module Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Django import error in views - no module named 'x' up vote 1 down vote favorite I keep getting no module named an error that there's no such module. The project name is gmblnew, and I have two subfolders- core and gmblnew - the app I'm working on is core. My urls.py file is from django.conf.urls import * # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Examples: # url(r'^$', 'gmblnew.views.home', name='home'), # url(r'^gmblnew/', include('gmblnew.foo.urls')), url(r'^league/', include('core.views.league')), # Uncomment the admin/doc line below to enable admin documentation: url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: url(r'^admin/', include(admin.site.urls)), ) This seems to be fine. The views.py file is: from django.http import HttpResponse def league(request): from core.models import Division response = HttpResponse() response['mimetype'] = 'text/plain' response.write("<>BODY>\n") response.write("< TABLE BORDER=1>