Wednesday, August 29, 2018

Re: Help with mi first hello world please problems with urls

Why are you returning  a string into the response ,there are different approaches  to this .

On Thu, 30 Aug 2018, 07:36 Anirudh choudhary, <anirudhchoudary007@gmail.com> wrote:
if you understand English then use include() in your mysite.urls.py 
which is in from django.urls import include

On Wednesday, August 22, 2018 at 10:31:19 PM UTC+5:30, Dario Coronel wrote:
El problema que tengo es el siguiente soy un novato recien conociendo el mundo de python y django estaba siguiendo los pasos de la documentacion para crear una primera aplicacion consegui instalr django y craer con startproject un projecti inicial sin problemas, mi primer problema se presenta cuando configuro las urls al crear con el $python manage.py startapp polls dichos archivos sigo los pasos hasta donde en el archivo polls/views.py  se incrusta el siguiente codigo 


polls/views.py
 from django.http import HttpResponse


def index(request):
    return HttpResponse("Hello, world. You're at the polls index.")

luego sigue
crear un archivo urls.py en el mismo directorio
polls/      __init__.py      admin.py      apps.py      migrations/          __init__.py      models.py      tests.py      urls.py      views.py

luego sigue incrustar el codigo en el archivo

polls/urls.py
from django.urls import path    from . import views    urlpatterns = [      path('', views.index, name='index'),  ]
seguido de agregar el siguiente codigo al siguiente directorio
mysite/urls.py
from django.contrib import admin  from django.urls import include, path    urlpatterns = [      path('polls/', include('polls.urls')),      path('admin/', admin.site.urls),  ]

De ahi en teoria al ejecutar en la consola $python manage.py runserver debria de poder ver el hola mundo y solo me da el error de 

Not Found

The requested URL / was not found on this server.



cual seria mi error agradecreia mucho una ayuda.....

--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fb4c03f1-8d23-4ca0-bb11-b0a0a9ba1145%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAO87g12nttWapXy%2BK19wWNmiyiAh0o-1rcVMUrELM%3Dc6VtJJbg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment