List Info

Thread: problem with static content




problem with static content
user name
2006-11-02 12:20:20
i've got some problem to use static content with cherrypy
3.0
i've read this :
http://groups-beta.googl
e.com/group/cherrypy-users/browse_thread/thread/e1e7d4088dcd
deac
and this :
http://groups-beta
.google.com/group/cherrypy-users/browse_thread/thread/7999f3
fa176b0697?hl=en

but it's still doesn't help me....
I've got this directory tree :


cherry.py
img
     Bussiere.jpg

here is my code :


import cherrypy,os
current_dir = os.path.dirname(os.path.abspath(__file__))
settings = {

            'global':{
                      'server.socket_port' : 664,
                      'tools.staticdir.root' : current_dir
                      },
            'img':{
                   'tools.staticdir.on' : True,
                   'tools.staticdir.dir' : "img"
                   }

            }

class header_begin:
    def __init__(self):
        self.header = "<body>"
    def printh(self):
        return  self.header

class header_end:
    def __init__(self):
        self.header = "</body>"
    def printh(self):
        return  self.header

class write_page:
    def __init__(self):
        self.page = """
        <table width=100% height=100%>
        <tr width=100% height=100%>
        <td width=100% height=100%>
        Bussiere<br>
        Python Programmer for hire2<br>
        web site : <a
href="http://www.bussieresama.net&
quot;>http://www.bussieresama.net</a><br>
        <img src="img/bussiere.jpg">
        </td>
        </tr>
        </table>
        """
class root:
    def __init__(self):
        pass
    nom = ""
    passwd = ""
    def doLogin(self, username=None, password=None):
        self.nom = username
        self.passwd = password
        return self.page()
    def index(self,username=None,password=None):
        return self.page()


    index.exposed = True
    doLogin.exposed = True



    def page(self):
        h1 = header_begin()
        h2 = header_end()
        pagewrite = write_page()
        page = pagewrite.page
        page = "%s %s %s %s %s"
%(h1.printh(),page,self.nom,self.passwd,h2.printh())
        return page


cherrypy.config.update({'environment':
'production','log.screen':
True})
cherrypy.config.update(settings)
cherrypy.quickstart(root())


help will be nice.

Regards
Bussiere


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at ht
tp://groups-beta.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )