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!

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 Flask Basics Character Builder Flash Messages

My flash message is not center and white text like Kenneth's.

My title text comes out as left and grey. Is this a default setting or did Kenneth code in the style somewhere else?

3 Answers

It works!! Thank you! I knew I was missing something!

Yes! Programming is the most rewarding-bitter-sweet-torturous task on this planet!

Kortney Field Make sure the DIV under the body has the class "messages" included. If you reference his main.css file, you can see where these styles are coming from.

.messages li {
    color: #fff;
    display: block;
    font-size: 1.2em;
    font-weight: bold;
    letter-spacing: 0.025em;
    text-align: center;

Let me know if you have anymore questions.

I checked and it shows what you stated. I am still having the same issue. Could you look at my code and see if I am missing something?


<!DOCTYPE html>
        <title>Character Generator</title>
        <link rel="stylesheet" href="/static/css/normalize.min.css">
        <link rel="stylesheet" href="/static/css/main.css">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1">
      <div class="wrap no-bottom messges bg-{{ saves.get('colors', 'yellow') }}">
        {% with messages = get_flashed_messages() %}
        {% if messages %}
        <ul class='flashes'>
          {% for message in messages %}
          <li>{{ message }}</li>
          {% endfor %}
        {% endif %} 
        {% endwith %}
        {% block content %}{% endblock %}

main.css file for .messages

.messages li {
    color: #fff;
    display: block;
    font-size: 1.2em;
    font-weight: bold;
    letter-spacing: 0.025em;
    text-align: center;

my app.py file

import json
from flask import (Flask, render_template, 
                   redirect, url_for, request, 
                   make_response, flash)

from options import DEFAULTS

app = Flask(__name__)
app.secret_key = 'jflksdjfljiefnsnvlkrhtlsbjkvlkfjg'

def get_saved_data():
    data = json.loads(request.cookies.get('character'))
  except TypeError:
    data = {} 
  return data

def index(): 
  return render_template('index.html', saves=get_saved_data())

def builder(): 
  return render_template(

def save(): 
  flash("Looks good! Saved changes")
  response = make_response(redirect(url_for('builder')))
  data = get_saved_data()
  response.set_cookie('character', json.dumps(data))                       
  return response

app.run(debug=True, host='', port=8000)

Kortney Field you spelled "messages" when adding it to the DIVs list of classes. You wrote "messges". Programming can be a pain right?