Skip to content

Commit

Permalink
index view should be catch all
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmelin committed Jun 12, 2012
1 parent 812cf40 commit 02e4d32
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions main.py
Expand Up @@ -12,17 +12,6 @@
app.register_blueprint(api.user.page, url_prefix="/api/user")
app.register_blueprint(api.project.page, url_prefix="/api/project")

@app.route("/")
@app.route("/discover")
@app.route("/project/create")
def index():
user_session = {}
if 'user_id' in session:
user = User.get(session['user_id'])
if user is not None:
user_session = db.json_encode(user.to_dict())
return render_template('index.html', user_session=user_session)

@app.route("/signup")
def signup():
return render_template('signup.html')
Expand All @@ -33,6 +22,16 @@ def logout():
del session['user_id']
return redirect('/')

@app.route("/")
@app.route("/<path:path>")
def index(path='/'):
user_session = {}
if 'user_id' in session:
user = User.get(session['user_id'])
if user is not None:
user_session = db.json_encode(user.to_dict())
return render_template('index.html', user_session=user_session)

@app.errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404
Expand Down

0 comments on commit 02e4d32

Please sign in to comment.