[Answered ]-Can't see view.py in my browser. Django

2👍

Your indentation is off:

from django.http import HttpResponse

def main_page(request):
    output = '''
        <html>
            <head><title>%s</title></head>
            <body>
                <h1>%s</h1><p>%s</p>
            </body>
        </html>
    ''' % (
        'Django Bookmarks',
        'Welcome to Django Bookmarks',
        'Where you can store and share bookmarks!'
    )

    return HttpResponse(output)

Python uses indentation to denote blocks, so if your code isn’t indented properly, it won’t run as you’d like it to.

Leave a comment