Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 16595

ModuleNotFoundError: No module named 'view'

$
0
0

So in my urls.py folder, I have the following code:

from django.urls import pathfrom view import views#URLConfurlpatterns = [    path('hello/', views.say_hello)]

The error I get when I am trying to python manage.py runserver is

File "/Users/swathikumar/Desktop/storefront/playground/urls.py", line 3, in from view import viewsModuleNotFoundError: No module named 'view'

View is a folder I created which has both init.py file and views.py file which has the following code:

from django.shortcuts import renderfrom django.http import HttpResponse# Create your views here.# request -> response# request handler# actiondef say_hello(request):    return HttpResponse('Hello World.')

I do not know how to solve this error of resolving the import of views into urls.py. All these files are in a playground app folder.

I was expecting my serevr to give me Hello World upon entering the http request.


Viewing all articles
Browse latest Browse all 16595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>