Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

499
Visualizações
how to overcome the following url issue?

Hello I am beginner learning Django I am triying to follow this tutorial:

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

I created an app called Polls to test my site:

Since I dont have idea where to put the file called urls.py I put this file at the following directories:

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

This file contains:

from django.conf.urls import url

from . import views

urlpatterns = [
    url(r'^$', views.index, name='index'),
]

And finally I added the following lines:

at this level:

Django/mysite/mysite/urls.py

this file contains:

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')),

]

I dont know where is the issue but when I run:

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.

I got in the page the following:

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.

So I really appreciate support to overcome this issue, thanks for the support

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

the urls.py doesn't go into the migrations folder.

Did you register your Polls app in the settings.py file? you need to add the name of the Polls app to the INSTALLED_APPS list.

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',]

you then need to create a url.py file within your polls app.

polls/
     urls.py

In that file you would add:

from django.conf.urls import url

from . import views

urlpatterns = [
    url(r'^$', views.index, name='index'),
]

the url you want to use in your browser would be something like this:

 http://127.0.0.1:8000/polls
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda