最近,我正试图从https://github.com/arvoelke/Dixit为学校节日制作Dixit在线服务器,但我遇到了一个问题。当我在我自己的Pythonanywhere web选项卡上重新加载我的Web应用程序时,错误日志显示,
'Typeerror:调用()只需要2个参数(3个给定)'。
我试图在每个Dixit代码中找到'调用()'函数的位置,但我找不到它。我该怎么办?
这是一个与WSGI相关的代码,这个代码是'server.py'。
class Application(tornado.web.Application):
"""Main application class for holding all state."""
def __init__(self, *args, **kwargs):
"""Initializes the users, games, chat log, and cards."""
self.users = Users()
self.games = []
self.chat_log = ChatLog()
# Specifies where to find all the card images for each set.
self.card_sets = [CardSet(name, find_cards(folder), enabled)
for name, (folder, enabled) in kwargs['card_sets'].iteritems()]
self.admin_password = kwargs['admin_password']
super(Application, self).__init__(*args, **kwargs)
settings = {
'static_path' : os.path.join(os.path.dirname(__file__), 'static'),
'template_path' : os.path.join(os.path.dirname(__file__), 'templates'),
'debug' : True
}
configFilename = (sys.argv + ['config.json'])[1]
settings.update(config.parse(os.path.join(os.path.dirname(__file__),
configFilename)))
application = Application([
(r'/', MainHandler),
(r'/admin', AdminHandler),
(r'/main.js', MainJSHandler),
(r'/main.css', MainCSSHandler),
(r'/setusername', SetUsernameHandler),
(r'/create', CreateHandler),
(r'/getgames', GetGamesHandler),
(r'/getusers', GetUsersHandler),
(r'/game/([0-9]+)/(.+)', GameHandler),
(r'/chat', ChatHandler),
], **settings)
if __name__ == "__main__":
application.listen(settings['port'])
tornado.ioloop.IOLoop.instance().start()
这个是'jangheunghsstudentserver_pythonanywhere_com_wsgi.py'。
import tornado.web
import tornado.wsgi
def application(environ, start_response):
if environ.get('PATH_INFO') == '/':
status = '200 OK'
# content = HELLO_WORLD
else:
status = '404 NOT FOUND'
content = 'Page not found.'
response_headers = [('Content-Type', 'text/html'), ('Content-Length', str(len(content)))]
start_response(status, response_headers)
yield content.encode('utf8')
import sys
path = '/home/JangheungHSStudentServer/DixitOnline'
if path not in sys.path:
sys.path.append(path)
from server import application
请注意。我不使用任何python web框架,如django,flask。