Search code examples
javascriptpythontornado

How to deploy Tonardo web server with python on ubuntu16.04?


I've built server.py which is responsible for launching server and send the data from csv file to browser with python Tornado web server. Then I use python command like this.

$ python server.py

But AttributeError has occurred.

Traceback (most recent call last):
  File "server.py", line 197, in <module>
    app.autoload.listen(80)
AttributeError: 'Application' object has no attribute 'autoload'*

The server.py is as follows.

#!/usr/bin/python 
# -*- coding: UTF-8 -*-# enable debugging 
from tornado.ioloop import IOLoop, PeriodicCallback
import tornado.ioloop
import tornado.web
import tornado.websocket
import json
import os
import csv
import sqlite3
..................
args={}
settings = {
    "static_path": os.path.join(os.path.dirname(__file__), "static"),
}
app = tornado.web.Application([
    (r'/cols', ColsHandler),
    (r'/', UploadHandler),
    (r'/conn', ConnHandler)],
    debug=True, **settings)
app.autoload.listen(80)
IOLoop.instance().start()

I don't understand what's going on here. I would like someone to tell me why this exception is appeared.


Solution

  • The line app.autoload.listen(80)

    should be written as

    app.listen(8080)  // or any other port that is not being used