how to create url helloworld

32 views
Skip to first unread message

paidjoo indo

unread,
Sep 19, 2020, 11:15:34 AM9/19/20
to Django users
*file views.py in folder pages

from django.htpp import HtppResponse
from django.shortcuts import render

# Create your views here.
def home_view(*args, **kwargs): # *args, **kwargs
    return HtppResponse("<h1>hello world</h1>")  


C:\Users\leo>C:/python37/python.exe c:/python37/Try-Django-master/src/pages/views.py
Traceback (most recent call last):
  File "c:/python37/Try-Django-master/src/pages/views.py", line 1, in <module>
    from django.htpp import HtppResponse
ModuleNotFoundError: No module named 'django.htpp'

from django.htpp import HtppResponse
from django.shortcuts import render

*files urls.py 

from django.contrib import admin
from django.urls import path

from pages import views

urlpatterns = [
    path('', views.home_view, name='home'),
    path('admin/', admin.site.urls),
]

file setting
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    # third party
    # own
    'pages',
    'products',
]

error :   
File "C:\python37\Try-Django-master\src\trydjango\urls.py", line 19, in <module>
    from pages import views
  File "C:\python37\Try-Django-master\src\pages\views.py", line 1, in <module>
    from django.htpp import HtppResponse
ModuleNotFoundError: No module named 'django.htpp'

coolguy

unread,
Sep 19, 2020, 2:40:45 PM9/19/20
to Django users
Instead of 
from pages import views  

use
from . import views

RANGA BHARATH JINKA

unread,
Sep 19, 2020, 10:50:25 PM9/19/20
to django...@googlegroups.com
Hi, 

   Please check the typo.

   It is django.http

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/64c882b9-9ab4-49a5-9a72-347cdadd324dn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages