Saturday, September 19, 2020

Re: how to create url helloworld

Hi, 

   Please check the typo.

   It is django.http

On Sun, 20 Sep 2020, 12:11 am coolguy, <cooldjangoprogrammer@gmail.com> wrote:
Instead of 
from pages import views  

use
from . import views
On Saturday, September 19, 2020 at 11:15:34 AM UTC-4 leoa...@gmail.com wrote:
*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'

--
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+unsubscribe@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.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK5m315eBUKiQA22O27JxuDQ3-p4sqBq0MEcWYCHiaSrLhh3wQ%40mail.gmail.com.

No comments:

Post a Comment