Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

490
Views
¿Cómo superar el siguiente problema de URL?

Hola, soy principiante aprendiendo Django. Estoy tratando de seguir este tutorial:

https://docs.djangoproject.com/en/1.11/intro/tutorial01/

Creé una aplicación llamada Encuestas para probar mi sitio:

Como no tengo idea de dónde colocar el archivo llamado urls.py, coloco este archivo en los siguientes directorios:

 Django/mysite/polls/urls.py Django/mysite/polls/migrations/urls.py

Este archivo contiene:

 from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.index, name='index'), ]

Y finalmente agregué las siguientes líneas:

en este nivel:

 Django/mysite/mysite/urls.py

este archivo contiene:

 from django.conf.urls import include, url from django.contrib import admin from django.conf.urls import url from django.contrib import admin urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^polls/', include('polls.urls')), ]

No sé dónde está el problema, pero cuando ejecuto:

 Django/mysite$ python3 manage.py runserver Performing system checks... System check identified no issues (0 silenced). You have 13 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions. Run 'python manage.py migrate' to apply them. April 21, 2017 - 15:59:43 Django version 1.10.5, using settings 'mysite.settings' Starting development server at http://127.0.0.1:8000/ Quit the server with CONTROL-C.

En la pagina tengo lo siguiente:

 Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/ Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order: ^admin/ ^polls/ The current URL, , didn't match any of these. You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.

Así que realmente aprecio el apoyo para superar este problema, gracias por el apoyo.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

el urls.py no va a la carpeta de migraciones.

¿Registraste tu aplicación Polls en el archivo settings.py? debe agregar el nombre de la aplicación Encuestas a la lista INSTALLED_APPS.

 INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'example: add app name here', 'polls',]

luego debe crear un archivo url.py dentro de su aplicación de encuestas.

 polls/ urls.py

En ese archivo agregarías:

 from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.index, name='index'), ]

la URL que desea usar en su navegador sería algo como esto:

 http://127.0.0.1:8000/polls
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!