Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9052157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:05:46+00:00 2026-06-16T13:05:46+00:00

I am new to python web frameworks. I am using web.py because I like

  • 0

I am new to python web frameworks. I am using web.py because I like how raw it is. I am wondering though, how one can produce pages and scripts efficiently when being restricted to sending output through the return keyword? It seems like for any python module you can only send one thing to the browser, even if it is a large string. What am I missing about the python way of server-side scripting? If it helps, I am coming from a PHP perspective. I am used to being able to say print “foo” and foo will appear. Now I am only allowed to print once per module. If you could point me in the direciton of a python approach to scripting vs the php approach I’d much appreciate it! I’m awful confused at this point how python can be so efficient while being so limited.

For example, here is a basic program I wrote:

 import web
 urls = ('/','index')
 class index:
     def GET(self):
         return "foo" ///Where this is the only place on the file I can output anything
 (and the rest of the file you should be familiar with)

The point is that it appears to me that the only place you could output anything is in the one return line? Now I understand that if the URI arguments change, you can map to a different class and thus output something differently, but even then this seems limited?

Or ultimately, is the point of the web framework to use ‘templates’ as they are called in web.py?
Thanks for the help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T13:05:47+00:00Added an answer on June 16, 2026 at 1:05 pm

    Yes, this is what templates are for: to efficiently separate logic from presentation.

    You have to query all data in your controller class and then pass it to template that will output html.

    This might seem different from common php practices, but I’m sure even php developers are choosing this approach.

    Regarding web.py, another option to stream content output is by using yield, see http://webpy.org/cookbook/streaming_large_files

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm starting a new Python web project. With most frameworks, everyone rushes to the
Are there any other good Python web frameworks? I'm looking to try something new,
For a new (Python) web application with the Pyramid web framework, I'd like to
I am new to python for web apps, and am using django for my
I'm new to Python and web development (although I have development experience with Client/Server
I'm a new Python programmer who is having a little trouble using 'self' in
Very new to python and can't understand why this isn't working. I have a
I'm really interested in learning Python for web development. Can anyone point me in
I'm a java developer new to python. In java, you can access all classes
I am new to web frameworks. I always imagined that they'll be working as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.