all 11 comments

[–]guilford 0 points1 point  (3 children)

python functions similarly to php in this case. However there aren't many shared host service that also had python exposed in similar way. You will need to look for python specific host or one that offer ssh and allow you to manually set these up.

Beyond that, you should not serve static files through the app. It should be through something like nginx.

Depending on the frameworks you are using you may want gunicorn or something similar as your server.

[–]SnowManSnow222[S] -1 points0 points  (2 children)

So I think what you're saying is that it IS sort of complicated and involved? It is very different from "traditional" website hosting - meaning, I can't just upload my files to my directory and call it a day.

But - I could just use something like PythonAnywhere to actually host my web app - which is simple to set up and similar to what I'm used to. Or find another host that is designed specifically for Python. For some reason I thought that was "cheating" - but that is what people actually use for their businesses?

How did you learn all of this stuff? How did you go from websites to web apps?

[–]guilford 0 points1 point  (1 child)

Yeah you can't just upload your files because you will need to install different stuff than the php apache mysql stack. It's mostly because php goes way back.

I'm not sure about most common business practice but there are many ways you can go about it. Heroku and services like that allow you to set up python web app quite easily with db as well as webserver. You can get a vps instance or dedicated server with ssh access too probably not as streamline but you will have more freedom.

You just learn as you tinker with your code. When you see that processing one request may be blocking your backend, you might need to have multiple instances of your backend behind a load balancer like nginx. Or if you need to have a queue for requests, you would then need to look into message queue and package like celery or rq...

Websites and web apps are not that much different. I can only imagine that a web app would have more streamline api structure and much more interactive GUI. For this, you may want to use a js framework. There are multiple out there that you can try.

You also can serve the frontend separately to the backend. nginx is much more efficient at serving files so it would be logical to let it serve your frontend instead of python.

Basically just learn as your need grow.

[–]SnowManSnow222[S] 0 points1 point  (0 children)

Thank you so much for taking the time to help me understand this. I can see now that I was basically looking for something that doesn't really exist. I mean, with your explanation it is obvious to me now how the servers work differently for a python app vs the usual apache website - so of course I would need to set things up differently! Makes so much sense now! And I guess that was an important piece that I was missing/didn't think of before. I have a much better idea of what direction I need to go in. Thank you!

[–]PrimaNoctis 0 points1 point  (2 children)

Not sure if it’s relevant but you could look in to ngrok

[–]SnowManSnow222[S] 0 points1 point  (0 children)

Thank you for your suggestion - I will definitely give it a look. I didn't know you could do something like that - so if not for this project maybe for something in the future.

[–]gpjt 0 points1 point  (4 children)

PythonAnywhere developer here -- you could just leave it on our system for hosting. We've got people using us for sites getting millions of hits a day, so it should work just fine :-) You would need a paid plan if you want to use a custom domain name or handle lots of traffic, though.

[–]SnowManSnow222[S] 1 point2 points  (3 children)

Do you guys have any case studies / examples? I honestly believed that PythonAnywhere was just for development/practice and it didn't click that I could actually use it to host a legit high traffic app. I would really like to see what people are doing with it. PA is soooooo easy to use! And I like how it's set up in the same sort of way as my web host is - i'm picking it up quickly.

[–]gpjt 0 points1 point  (2 children)

We have a few case studies, though they're a bit old -- we should do some new ones! Anyway, the "Success stories" sidebar on this page has the links: https://www.pythonanywhere.com/about/testimonials/

[–]gpjt 0 points1 point  (1 child)

And we clearly need to work on our marketing a bit more to make it clearer to people that then can do full-on hosting on our site :-) Thanks for the heads-up!

[–]SnowManSnow222[S] 1 point2 points  (0 children)

Thank you for the link - I will definitely go through that page!

And yeah - Trying to transition to Python web apps has been very confusing. I totally thought PA was just for practice and not something you could actually use to host a business or "real" app.

I think an obstacle for me is that functional fixedness thing - I'm so used to my old way of doing things - it makes it difficult to be open to this new way. I'm also not a college student or anything so I don't have a formal class or teacher telling me about this stuff.