Hi All,
I need to display logo according to url in login page. I tried to
display the logo but it always shows *404 not found* error on login page.
My app settings are below:
*models/db.py*
db.define_table('company',
Field('name', 'text', notnull=True),
Field('abbrev', 'string', length=32),
Field('logo', 'upload', uploadfield=True,
requires=IS_IMAGE()),
Field('timezone', 'string',
requires=IS_IN_SET(all_timezones)),
Field('url', 'string',
requires=IS_URL()),
format='%(name)s')
*controllers/default.py*
def user():
"""
exposes:
http://..../[app]/default/user/login
http://..../[app]/default/user/logout
http://..../[app]/default/user/register
http://..../[app]/default/user/profile
http://..../[app]/default/user/retrieve_password
http://..../[app]/default/user/change_password
http://..../[app]/default/user/manage_users (requires membership in
use @auth.requires_login()
@auth.requires_membership('group name')
@auth.requires_permission('read','table name',record_id)
to decorate functions that need access control
"""
#set some default name
abbrev_name = 'ASDF'
company_rec =
db(db.company.url.contains(request.env.http_host)).select().first()
if company_rec:
abbrev = company_rec['abbrev']
logo = IMG(_src = URL('default', 'show_logo', company_rec['logo']))
session.company_timezone = company_rec['timezone']
return dict(form=auth(), abbrev=abbrev, logo=logo)
def show_logo():
return response.download(request, db)
*views/default/user.html:*
<html>
<head> .... </head>
<body>
<div class="logo" style="display: inline-block;">
<h2> {{=logo}} </h2>
<h2>{{=abbrev}}</h2>
</div>
<!-- some code for login / log_out / change_password -->
</body>
</head>
It shows following error as:
1. Remote Address:
127.0.0.1:8000
2. Request URL:
https://127.0.0.1:8000/default/show_logo/investor.logo.91f2753b1fabaab6.736571756f69615f6361706974616c5f6c6f676f2e676966.gif
3. Request Method:
GET
4. Status Code:
404 NOT FOUND
Is there any way to display blob image ?
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.