I am trying to create a website with Web.py, but I am not allowing me to open the socket on port 80, but it works on every other port.
I have a port redirected and all that, so that is not a problem.
python main.py 80
but when I do this, I get an error:
http://0.0.0.0:80/ Traceback (most recent call last): File "main.py", line 43, in <module> app.run() File "/usr/local/lib/python2.7/dist-packages/web/application.py", line 311, in run return wsgi.runwsgi(self.wsgifunc(*middleware)) File "/usr/local/lib/python2.7/dist-packages/web/wsgi.py", line 54, in runwsgi return httpserver.runsimple(func, validip(listget(sys.argv, 1, ''))) File "/usr/local/lib/python2.7/dist-packages/web/httpserver.py", line 148, in runsimple server.start() File "/usr/local/lib/python2.7/dist-packages/web/wsgiserver/__init__.py", line 1753, in start raise socket.error(msg) socket.error: No socket could be created
My code so far:
import MySQLdb import web import hashlib as h urls = ( '/', "index", "/register/?", "register", "/login/?", "login", "/thankyou/?", "thankyou" ) app = web.application(urls, globals()) render = web.template.render("templates/") db = web.database (dbn="mysql", user="root", pw="461408", db="realmd") class index(): def GET(self): return render.index() class register(): def GET(self): return render.register() def POST(self): i = web.input() user = h.sha1(i.username).hexdigest() pw = h.sha1(i.password).hexdigest() n = db.insert("account", username=user, password=pw) if __name__ == '__main__': app.run()
Can anyone help?