Page Redirect Error -URL

1

I'm super beginner with Python and Django and unfortunately I'm suffering a lot with urls . The problem you give is " Página não encontrada (404) ". Here are some excerpts from the code:

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

]

views.py

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")
    
asked by anonymous 03.06.2015 / 06:24

1 answer

1

Doing some research solved this problem differently. But thank you in advance for your help! See below how it was:

urls.py

from django.conf.urls import patterns,include, url
from django.contrib import admin

urlpatterns = [

    url(r'^admin/',include(admin.site.urls)),
    url(r'^$', 'web.views.homepage', name="index"),

]

views.py

__author__ = 'Sara Fernandes'

from django.shortcuts import render_to_response, render
from django.template import RequestContext, loader

#from django.http import HttpResponseRedirect # Funcao para redirecionar o usuario
#Criar as Views aqui

# pagina inicial do projeto dweb

def homepage(request):
    return render_to_response('index.html',
        context_instance= RequestContext(request))
    
03.06.2015 / 19:58