Build Python web apps with Django: Codcademy browser bug


I am doing the course Build Python web apps with Django:

I am working on the mini-project The Django Djitney:

As soon as I add any new Views in the file (from step 6 onwards), the browser integrated into the Codecademy interface does not work anymore. More specifically, it just displays a blank page when I reload the home page of the mini-website I am trying to build.
This happened even after I added just the following code in

class LinesView(ListView):
  model = Line
  template_name = 'routes/lines.html'

I cannot find any explanation for that.

Also, in several of the templates provided, there are code mistakes that I corrected (note that the browser bug happened also before I realised there were some bugs in the HTML templates).
In particular, I noticed a wrong use of quotes around strings in the {% url %} tags used in some templates.

Can anyone please help me?

Thank you very much in advance!

1 Like

The template_name is ‘routes/add_line.html’ instead of ‘routes/lines.html’, you can find it in the routes template file.

Thank you very much indeed, but unfortunately it still doesn’t work.

Also, I thought that the template routes/add_line.html should have been used for the CreateLineView class, as follows:

class LinesView(ListView):
  model = Line
  template_name = 'routes/lines.html'

class CreateLineView(CreateView):
  model = Line
  form_class = LineForm()
  template_name = 'routes/add_line.html'

Any thoughts about what else could have caused the bug?
Thanks again!

Oops my bad on spotting the wrong parts, hrmm I think the LineForm does not need the () behind since it is imported from the top as LineForm.

1 Like

thank you for spotting my mistake!
However, it does not work anyways.
BUT, as far as I saw while doing the course, when there is even the tiniest mistake the mini-browser shows a blank page.
So, I will go again all over the code to find it, it would be impossible for you to spot it, I reckon you would need to read through the whole thing.
Thank you very much again for the help!!

Hi, I have the same errors, I used “python3 runserver” in the terminal, so by doing this, I have been able to check the routes in the browser: D. I advanced
only up to step 7, hahah I was frustared because the paths didn work and did all this 7 steps around three times xd. Hope this help you.

1 Like

thank you very much!
I will try do the same, and do the whole exercise once again as soon as I finish with the course.
I’ll keep you posted!

1 Like

To wrap things up, final recommendations:

  1. As far as I know, there are no bugs in the mini-browser. You just need to write the code really carefully, even a comma in the wrong place (or a missed comma after a call to path()) m make the browser show a blank page.

  2. There are a few mistakes in some of the HTML templates, and these are shown in this .txt file.

  3. Finally, it is important to add a success_url in the DeleteLineView, as follows (but this is not indicated in the instructions):

class DeleteLineView(DeleteView):
  model = Line
  template_name = 'routes/delete_line.html'
  success_url = '/lines/'

That is all I know, I will mark this problem as solved.
Thank you very much all for your support!


Hey, don’t know if this will help anyone, but realllllyyyy look through your code to see if you’ve missed a / or something!

Also, if you remove the comments from the wrong nav element, that can screw you up too!