Forums

Socket.error

Hello. I get

socket.error: [Errno 13] Permission denied

When i start app like this way:

APP_HOST = '127.0.0.1'
APP_PORT = 80

from wsgiref.simple_server import make_server
try:
    print('Starting app at http://'+APP_HOST+':'+str(APP_PORT)+'/')
    make_server(APP_HOST, APP_PORT, main).serve_forever()
except KeyboardInterrupt:
    pass
print("\n Have a nice dev !")

And the pythonanywhere_com_wsgy.py

import os
import sys

path = '/home/dvase/app/server-api'
if path not in sys.path:
    sys.path.append(path)

import app as application

Wrong direction ?

On PythonAnywhere, you don't need to (and, in fact, can't) run your own server. We run the server for you and you just need to point us at the application. That's what the final import in the wsgi file is. So you probably want to change the import at the end of the WSGI file to import your WSGI application and name it application.