Forums

BaseHTTPServer Setup

Hi everyone.

I'm trying to setup a JSON based API i created, which is written on top of BaseHTTPServer. Right now, I don't care which port is binded for the server

When I try to bind port 80, I get an access denied error, and when i try to bind any other port the domain name ("user.pythonanywhere.com") does not redirect the request to the server.

any help? Thanks a lot!

That's not how PythonAnywhere works.

If you wrote your JSON api system in a Python framework like Flask, Bottle, etc., then you can just create a new web app fromn the web tab, and then copy your flask app into the approporiate directory. (Make sure the WSGI file is pointing in the right direction).

(What you probably should do is read the basic info for Flask - because that's REALLY easy to use. Then copy your code across so it sits behind a Flask front-end. You can get rid of BaseHTTPServer because it's 10x more hassle than Flask.)

Thanks a lot! I'll be using flask as you suggested