Andromedae93 Andromedae93 - 1 year ago 49
Python Question

Page not found (404) with Django

I'm learning Django Framework and I'm following a tutorial based on Django 1.8.
I have Django 1.10 on my Mac OSX and I get an error :

Page not found

I started a project which is named
and I created an app :

The blog looks like :

from django.conf.urls import url
from django.contrib import admin
from blog.views import home

urlpatterns = [
url(r'^accueil/$', home),

The blog looks like :

#-*- coding: utf-8 -*-

from django.shortcuts import render
from django.http import HttpResponse # Ce module permet de retourner une réponse (texte brute, HTML, JSON, ...) depuis une string

# Create your views here.

def home(request) :

text = """<h1>Bienvenue sur mon blog ! </h1>
<p> Edité sous Django 1.10 </p>"""
return HttpResponse(text)

And the crepes_bretonnes looks like :

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

urlpatterns = [
url(r'^blog/', include('blog.urls'))

However, when I'm running the server, I get this error (picture) and I don't understand why it's not working :/

enter image description here

As I said, I'm beginning Django so if anyone can explain me the problem ?

Thank you !

Answer Source

Your crepes_bretonnes urls are including blog urls, so your blog urls are only visible from blog/ url.

If you want to get to your view you need to open this url:


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download