Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic App Output #2

Closed
gloc-mike opened this issue Mar 10, 2021 · 8 comments
Closed

Basic App Output #2

gloc-mike opened this issue Mar 10, 2021 · 8 comments

Comments

@gloc-mike
Copy link

Hi Mike,

Not sure why but the output I'm getting from the basic app does not display the JSON, Raw Data, etc. fastAPI tabs at the top of the browser window like your example shows.

Do you know why that might be?

Mine:
Screen Shot 2021-03-10 at 21 17 31

Yours:
Screen Shot 2021-03-10 at 21 16 43

Thanks
Michael

@mikeckennedy
Copy link
Member

Hi @gloc-mike That is odd. I don't know why you're seeing that. I'd guess the web method looks like:

def index():
   return "Hello world"

The one I have is:

def index():
   return {"message": "Hello world"}

If that's not it, perhaps it's formatting in your browser? Do a view source also I guess to be sure. Let me know what you find.

@gloc-mike
Copy link
Author

Hi @mikeckennedy,

Thanks for the response. I tried both but neither altered the browser look.

I thought it might be browser specific so I tried Opera, Safari and re-downloaded Chrome but all produce the same result.

In Opera, I found this error:
Screen Shot 2021-03-11 at 09 52 12

But I don't see that error in Safari nor in Chrome so probably Opera specific. There are no exceptions anywhere else in any of the browsers that I can find.

Any other thoughts?

@gloc-mike
Copy link
Author

Hi @mikeckennedy,

I pushed my program files to GitHub. I know it's simple but I might have some domestic blindness and have missed something really obvious.

https://github.com/gloc-mike/Faux-PyPI

@mikeckennedy
Copy link
Member

Thanks. I ran your version in github. Here's what I get with it exactly as is which is return "hello world" and the output is the same as you have:

Screen Shot 2021-03-10 at 9 03 44 PM

But running this version:

@app.get('/')
def index():
    return {
        'message': "Hello World"
    }

Gets me:

Screen Shot 2021-03-10 at 9 04 01 PM

I think what you might be seeing is you must restart the web app, not just change and save the python file to see any difference.

@gloc-mike
Copy link
Author

Hi @mikeckennedy,

Yes, I alway restart the server after making changes. It doesn't make any difference which version of the return statement I use, I still do not get the "JSON Raw Data Headers" FastAPI buttons displayed in the browser.

I looked through the FastAPI issues but could not find anything related to this.

@mikeckennedy
Copy link
Member

Oh, I misunderstood the part you're looking for. You have to use a browser with that display. The reason I have that is because I use Firefox. I wouldn't get that on brave/chrome/safari/etc.

@gloc-mike
Copy link
Author

Oh sorry @mikeckennedy ! My bad. I shouldn't have mixed the output screenshots like that.

We got there in the end! :) Thanks! Firefox all the way! Yay! :)

@mikeckennedy
Copy link
Member

Glad you got it figured out. Yes, the mixed browser content threw me off. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants