#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2004
    Posts
    9
    Rep Power
    0

    Problem Displaying HTML with Python


    I'm very new to Python(php programmer) , I'm having trouble displaying HTML with Python, running on Apache. Other python scripts will run but when a python file has html, it doesn't display what I want correctly. I'm sure I'm missing some setting. Is there a setting in apache's conf file, or mod_python to make this work, or is their something I should include in the script to make it work?

    Bill
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Posts
    461
    Rep Power
    24
    you should just have to type print and put in the text that you are wanting.

    are you getting any errors? possible post some of your code up.
  4. #3
  5. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    13
    Originally Posted by billgrande
    I'm very new to Python(php programmer) , I'm having trouble displaying HTML with Python, running on Apache. Other python scripts will run but when a python file has html, it doesn't display what I want correctly. I'm sure I'm missing some setting. Is there a setting in apache's conf file, or mod_python to make this work, or is their something I should include in the script to make it work?

    Bill
    Hi Bill,

    There are many things that could be wrong but try this
    Code:
    #!/usr/bin/python
    page = '''
    <html>
    <head>
    </head>
    <body>
    Hello World
    </body>
    </html>
    '''
    print 'Content-type: text/html\n'
    print page
    For a little more info have a look at this link:
    pycodev

    Have fun

    grim
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2004
    Posts
    9
    Rep Power
    0
    Thanks for the help, that is basically what I tried, but I'll try your code.

    Bill
  8. #5
  9. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2004
    Location
    Meriden, Connecticut
    Posts
    1,797
    Rep Power
    154
    ASPN may be able to help. Simply go to the Python section, go to Python Cookbook, and search for what you want.

IMN logo majestic logo threadwatch logo seochat tools logo