Help with mi first hello world please problems with urls

33 views
Skip to first unread message

Dario Coronel

unread,
Aug 22, 2018, 1:01:19 PM8/22/18
to Django users
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.....

Anirudh choudhary

unread,
Aug 30, 2018, 2:36:10 AM8/30/18
to Django users
if you understand English then use include() in your mysite.urls.py 
which is in from django.urls import include

ireoluwa fakeye

unread,
Aug 30, 2018, 2:51:50 AM8/30/18
to django...@googlegroups.com
Why are you returning  a string into the response ,there are different approaches  to this .

--
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 post to this group, send email to django...@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.

Sonali Vighne

unread,
Aug 30, 2018, 4:17:57 AM8/30/18
to Django users

¿Dónde está tu archivo views.py? escribir la solicitud de importación en views.py


On Wednesday, August 22, 2018 at 10:31:19 PM UTC+5:30, Dario Coronel wrote:
Reply all
Reply to author
Forward
0 new messages