Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

Vittorio Somaschini
Vittorio Somaschini
33,371 Points

Tacocat challenge frontend struggle

Hello everyone.

I was dealing with the tacocat challenge (Python - build a social network with Flask).

I had always postponed it as I felt unsure but now it was time to do it for me and talking about the backend part I was able to complete it and it passed the code challenge when I inserted my code.

Here is the snapshot: https://w.trhou.se/t2cxjpmdiu

Troubles are on the frontend; can someone tell why I get a giant cat image that is completely different from the one in the quick look of the web app that Kenneth showed during the final video of this course?

If you fork the workspace, you will notice that the image is centered and it is huge! Completely different from the one showed by the teacher: he has the navigation on the left side and a small image of the cat right above it (the image is actually part of the nav).

We are not supposed to touch the css (I presume), so I can't understand where I went wrong there.

Any help will be appreciated.

Thanks

Vittorio

4 Answers

Josh Keenan
Josh Keenan
19,652 Points

Hey Vittorio,

your problem lies in your layout.html I believe.

line 27:

<img src='{{ url_for('static', filename="images/tacocat.svg") }}'>

You missed opening and closing quotations, hope this helps!

Josh Keenan
Josh Keenan
19,652 Points

I know it looks weird there but I think it should work!

Vittorio Somaschini
Vittorio Somaschini
33,371 Points

Thanks Josh.

I have correct that but still I have the same problem.

In the meantime I found something not working in the backend so I will try to correct that :D

Vitto

Josh Keenan
Josh Keenan
19,652 Points

Tagging the wonderful genius that is Chris Freeman!

Josh Keenan
Josh Keenan
19,652 Points

Did you remove app.run()?

Josh Keenan
Josh Keenan
19,652 Points

Huh, I'm stumped... not sure what it is then...

Hi Vittorio,

I don't think it's really an issue of you doing anything wrong.

I think the main point of the challenge was to see if you could write all the python code and the minimal html necessary to have a functioning app that passes all the tests. The layout and styling of the site are an optional thing.

I'll try to answer your question about why it doesn't look the same as Kenneth's shown in the video.

There needs to be both html and css changes in order to get something close to the video.

Either we didn't get the correct starter files so that once we filled in the blanks it would look like the video or maybe the intention was to start with a basic layout and you're supposed to design the layout the way you want.

The main thing that you need to do is get the nav and content block into a 2 column layout.

This project uses Skeleton I don't remember if it was covered at all but you can check the link to see how the html should be set up and what classes you can use. It's based on a 12 column grid.

I estimated that the nav should take up 3 columns and the content block would take up 9 columns.

Using the appropriate class names I updated the "row" div in layout.html to this:

<div class="row">
        <div class="three columns">
          <nav class="menu">
          <!-- menu goes here -->
              <img src={{ url_for('static', filename="images/tacocat.svg") }}>
              {% if current_user.is_authenticated() %}
              <p>Hello {{ current_user.email }}</p>
              <a href="{{ url_for('add_taco') }}">ADD A NEW TACO</a>
              <a href="{{ url_for('logout') }}">LOG OUT</a>
              {% else %}
              <a href="{{ url_for('register') }}">SIGN UP</a>
              <a href="{{ url_for('login') }}">LOG IN</a>
              {% endif %}
          </nav>
        </div>
        <div class="nine columns">
          {% block content %}{% endblock %}
        </div>
</div>

This gets it into 2 columns. Some css tweaks are needed at this point in tacocat.css in order to get the nav looking closer to the video. Let me know if you need help with the css.

Hopefully this gets you going in the right direction.

One thing I noticed in that css file is that there are selectors targeting dd and dt elements which would seem to indicate that we were supposed to use a description list somewhere. I think the home page is the only possibility since the other pages all contain forms.

Maybe a dl was used in an earlier version and then switched to a table later.

So I'm not really sure if we have the final version of the starter files.

Vittorio Somaschini
Vittorio Somaschini
33,371 Points

Ooook

Thanks Jason!! I will look into this

;)