1
I’m super beginner with Python
and Django
and unfortunately I’m suffering a lot with urls
. The problem is that "Página não encontrada (404)
". Below are excerpts of the code:
py.
from django.conf.urls import patterns, include, url
import web.views
urlpatterns = [
#url(r'^$/', 'web.views.home', name='home'),
url(r'^web/', 'views.index'),
]
py views.
from django.shortcuts import render_to_response, render
from django.http import HttpResponseRedirect # Funcao para redirecionar o usuario
#Criar as Views aqui
# pagina inicial do projeto dweb
def index(request):
return render_to_response("index.html")
You are using
DEBUG = True
in thesettings.py
? What URL is this error giving? If your server is running for example onlocalhost:8000
(the pattern ofrunserver
) then the only page that should be available - by the rules of yoururls.py
- is thehttp://localhost:8000/web/
. Is this URL giving 404? Or is it another?– mgibsonbr
Hello Earendul, Good Morning!!... Yes, I am using DEBUG = True. This is the url q is giving error: url(r' web/', 'views.index'), even if I add this url. It redirects me to this: http://127.0.0.1:8000/. Then there’s the mistake!!
– Sara Fernandes
That one
views.index
shouldn’t beweb.views.index
?– mgibsonbr
Hello mgibsonbr, good afternoon!!... I managed to solve more in another way, see what I posted now! But this question you asked me is very correct, it would be just in the previous case!!... Thank you :)!!
– Sara Fernandes