[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –
Django Tutorial for Beginners – 16 – Raising a 404 HTTP Error
by
Tags:
Comments
31 responses to “Django Tutorial for Beginners – 16 – Raising a 404 HTTP Error”
-
When i click on the names of the albums in /music/ im getting a blank page, no error just nothing.
-
Thanks so much :D.
-
Regarding simple database query and giving httpresponse you should also have a look at generic views!
-
Django tutorial 16 Raising a 404 HTTP Error
apps used in this tutorialmusictemplatesmusicindex.html
musictemplatesmusicviews.htmlmusicviews .py
-
I just started learning Django and Im using Django 2.0. I haven't found any tutorials of such good quality for Django 2.0 yet. If anyone has then please let me know. Having said that, I must add, this is the best channel to learn programming!
-
If you guys get an error saying "ValueError at Music/1" Make sure that your indentations are exactly the same in the video! I never knew that indentations affect your code in python.
-
too confusing
-
Hi I'm just starting Django and following the tutorials and I have the following problem right now:
under " Here are all my albums: " the page does show the albums but calls them album.album_title instead of the actual album title..
can someone help?? -
Getting error:
Using the URLconf defined in website.urls, Django tried these URL patterns, in this order:
^admin/
^music/ ^$ [name='index']
^music/ ^/(?P<album_id>[0-9]+)/$ [name='detail']
The current path, music/2, didn't match any of theseplease assist!
-
can't you put the all_albums, context variables one scope tier higher so that you can use it in all models?
-
Thank you so much Bucky youre awesome!
-
While following along and testing the code, I've never been so relieved to actually see a 404 message 😀
-
Silly question here perhaps but what "language" or mark up is the {%%} tag defined as? I am trying to get pyCharm to recognise it for the "inject language or reference" feature to work.
-
How does it know to only display the album name and the band name? album = Album.objects.get(id=album_id) looks like it would get all the objects to me.
-
Why can't I simply use SQL queries? What for is there that all bells and whistles? Could you explain this?
-
For Django 11 you might have to modify the detail function in views.py in the Music app while getting the album via id/pk from
“`album = Album.objects.filter(id=album_id) TO album = Album.objects.filter(id=album_id).get()“` -
Hi, I am getting Unresolved attribute reference 'DoesNotExist' for class 'Album', the same when I write Album.objects.all()
-
This might be mentioned further on but you can also import get_object_or_404 from django.shortcuts and use the following:
def detail(request, album_id):
album = get_object_or_404(Album, pk=album_id)
return render(request, 'music/detail.html', {'album':album})get_object_or_404 basically does exactly the same as the try-except thing.
-
im having hard time on tab error and indent (on python) while having your tutorial.
-
Hi… I would like to say 'Thank You' through this comment. Your Tutorial really helps me in getting my project created. Very detailed view of presenting the information and not too lengthy tutorials. It helps to pay attention to the videos fully. Was able to relate things and make my work to progress further. Thanks again.
-
{{ album }} in detail.html does not work!!!!!
its showing error – bad operand type for unary +: 'unicode'
This si what the pyCharm terminal says about this problem GET /music/1/ HTTP/1.1" 200 0
Also when I goto my /music it shows I dont have any Albums!!!!!when i go to that music/1 or music/2 it shows nothing and in console it shows error. Im using pyCharm as well.
please help anyone. -
Why doesn't line 18 run when except block runs? The command should come to it after the except block too, should't it?
-
You don't have any albumsPyCharm not recognized Python code inside an html file even after templating in {% %}?is it dependent on pycharm version?
-
hi all 🙂 i get a error ;S i cant solve it, it say that detail() got an unexpected keyword argument 'Noticia_id' i have done some changes but it is the same code jeje just testing it an learnig what it can be ?
this is my views
def index(request):
user= Usuario.objects.all()
return render(request,'users/index.html',{'user': user})def detail(request, usuario):
try:
users=Usuario.objects.get(usuario)
except Usuario.DoesNotExist:
raise Http404("Usuario no existe")
return render('users/detail.html', request, {'users':users})i have users in db and i can show then but when i click on then it gave me tha error :s and the urls are :
#/usuarios/
url(r'^$',views.index,name='Usuario'),#/usuarios/noticia-id/
url(r'^Noticia-(?P<Noticia_id>[0-9]+)/$',views.detail,name='detail'),ill wait for your help thanks 🙂
-
still getting no "you dont have any albums"
-
if bucky does not show all his changes cause some people follow him step by step :
Just in case:url(r'^(?P<depo_id>[0-9]+)$', views.detail, name='detail')
here it is solved (check the f*king slash!):
url(r'^(?P<depo_id>[0-9]+)/$', views.detail, name='detail')
-
NOT NULL constraint failed: music_song.album_title_id
getting the error when i do song.save() -
What is that Album.DoesNotExist? Where is it defined? In the Model? You do not show that in the tutorial. Replacing that line with except Exception: fixes it.
-
I have a quick question:
How do you make PyCharm recognize Python code even inside an html file and code?
Or is this part of the paid full-fledged version only?
Thanks. 🙂
-
Hi, I'm a student at Carnegie Mellon and your video on django has really helped me learn the tool a lot better. Thank you for making such wonderful videos and I can't wait to see more of them.
Leave a Reply