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 8290899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:56:52+00:00 2026-06-08T12:56:52+00:00

Here are you 2 functions in my django views. The first one and the

  • 0

Here are you 2 functions in my django views.
The first one and the second should do the same thing. But when I used the first function, it says “outside function” on the last line, which is “return HttpResponse(output)”.

Why is that?

Thanks,
Shiyam

def main_page(request):
    output = '''
        <html>
            <head><title>%s</title></head>
            <body>
                <h1>%s</h1><p>%s</p>
            </body>
        </html>
    ''' % (
        'Django Learning',
        'Welcome',
        'WYou can share book marks here!'
)
return HttpResponse(output)

def main_page(request):
    title_sowl = "Django Learning"
    header_sowl = "Welcome"
    text_sowl = "You can share book marks here"
    output = u"<html><head><title>%s</title></head><body><h1>%s</h1><p>%s</p></body></html>" % (title_sowl,header_sowl,text_sowl)
    return HttpResponse(output)
  • 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-08T12:56:53+00:00Added an answer on June 8, 2026 at 12:56 pm

    It’s because you need to indent that line in order for it to be considered a part of the main_page method.

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

Sidebar

Related Questions

I have two functions here function Preloader() {} Preloader.prototype = { init:function() { //
Here is the class: functions.php class buildPage { public function Set($var,$val){ $this->set->$var = $val;
I'm writing a delegate class but it fails to take const member functions. Here
First i want to thanks you for watching my post! I have used django
I'm doing a pretty simple thing here, making a POST request to Django from
For the functions here: #include <libkern/OSAtomic.h> there are OSAtomic and OSAtomicBarrier versions. However, the
I'm using the code here and I want all the functions which call SDL
What's going on here? I'm trying to create a list of functions: def f(a,b):
How to call multiple functions on button click event? Here is my button, <asp:LinkButton
Total noobie question here. I'm just learning Java, and studying passing arguments to functions.

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.