Code Monkey home page Code Monkey logo

Comments (6)

edavis avatar edavis commented on May 30, 2024 1

Ah, okay. I thought you had it running on your local machine and were trying to enable external access. Being on a VPS already should make this easier.

That server that launches on 127.0.0.1:5000 is only meant for local development. It's not the recommended way to deploy an app like this.

I'd suggest looking into http://gunicorn.org/. You'll run a command like gunicorn hnrss:app which'll load the app and listen on 127.0.0.1:8000. Then you'll configure Apache to pass incoming requests from the outside world to 127.0.0.1:8000.

There are more moving pieces with this method, but it'll be pretty robust. Plus it's the standard way of launching Python web apps so there are a ton of online docs to help you out.

An alternative, not recommended way is to change the line to something like app.run(host='0.0.0.0', port=5000, debug=False) which'll make the local development server listen on all available IP addresses. You'll then be able to connect via http://:5000/newest.

Definitely read the docs on this to make sure you understand why it isn't recommended for production use, though. But it can be useful as its a simpler setup than the gunicorn option.

Good luck!

from hnrss.

edavis avatar edavis commented on May 30, 2024

Hi Sascha — I'd recommend you buy a cheap VPS plan from a provider like DigitalOcean, Rackspace, Linode, etc. and host your local copy of hnrss there. With enough time and energy you might be able to host it on your local machine in a way that external services can find it, but it'll be a real hassle to get there.

Running it on a VPS won't be much different than how you're running it now, it'll just be much easier for the "outside world" to access it.

Hope this helps!

from hnrss.

srissel avatar srissel commented on May 30, 2024

Thanks for your answer,

I've already a VPS running, with apache and some other services working fine.

I am just wondering, which is the best way to get your python implementation running.
I found sites, describing how to integrate python executed as CGI scripts into apache. I think this would allow your scripts to be run by external requests.

But on the other hand: Your implementation is launching its own web server running on 127.0.0.1:5000. So why integrate it into apache?
Isn't the easiest way mapping the internal server on 127.0.0.1:5000 to some external port?
As described above, an IPTables entry didn't work.
Maybe I missed something. Therefore my question here...

If you can't help - thanks anyway!

from hnrss.

srissel avatar srissel commented on May 30, 2024

Many thanks this great explanation, it sounds really promising! I'll have a try with it,

from hnrss.

srissel avatar srissel commented on May 30, 2024

Again, many thanks!
During the last about 90 minutes I was able to install Gunicorn, configure apache to pass request to your Python application "hnrss" and habe it run automatically on boot.

Finally a nice way to integrate Hacker News into News Aggregetors (in my case Flipboard mobile app).
Perfect!

from hnrss.

edavis avatar edavis commented on May 30, 2024

Awesome! Glad to hear everything worked out.

from hnrss.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.