“在PythonAnywhere上托管基于Tornado的Python应用程序时出错,运行WSGI应用程序时出错

问题描述 投票:0回答:1

我正在尝试从Python和Virus on Network库托管MesaMesa is using Tornado以可视化服务器上​​的图形。 According to PythonAnywhere,似乎不推荐使用“龙卷风”,因为它具有异步能力,但是当不使用异步功能时,它仍然可以工作。我是网络托管的初学者,我尝试了以下操作,但没有用。

run.py

virus_on_network.server import server

app_server = server

if __name__=='__main__':
    app_server.launch()

wsgi.py

import sys
path = '/home/ABC123/mysite/'
if path not in sys.path:
    sys.path.append(path)

import tornado.web
import tornado.wsgi
from run import app_server as app  # noqa

application = tornado.wsgi.WSGIApplication([
    (r"/", app),
])

我得到了一些东西,但是JavaScript部分似乎没有执行。我确实将D3.js文件添加到了根目录中。

enter image description here

这应该是它的外观

enter image description here

server.log

2020-04-20 15:54:06 Mon Apr 20 15:54:06 2020 - received message 0 from emperor
2020-04-20 15:54:06 SIGINT/SIGQUIT received...killing workers...
2020-04-20 15:54:07 worker 1 buried after 1 seconds
2020-04-20 15:54:07 goodbye to uWSGI.
2020-04-20 15:54:07 chdir(): No such file or directory [core/uwsgi.c line 1610]
2020-04-20 15:54:07 VACUUM: unix socket /var/sockets/ABC123.pythonanywhere.com/socket removed.
2020-04-20 15:54:10 *** Starting uWSGI 2.0.17.1 (64bit) on [Mon Apr 20 15:54:08 2020] ***
2020-04-20 15:54:10 compiled with version: 5.4.0 20160609 on 09 January 2020 17:57:39
2020-04-20 15:54:10 os: Linux-4.4.0-1100-aws #111 SMP Thu Jan 9 16:34:29 UTC 2020
2020-04-20 15:54:10 nodename: blue-liveweb5
2020-04-20 15:54:10 machine: x86_64
2020-04-20 15:54:10 clock source: unix
2020-04-20 15:54:10 pcre jit disabled
2020-04-20 15:54:10 detected number of CPU cores: 2
2020-04-20 15:54:10 current working directory: (unreachable)/etc/uwsgi/vassals
2020-04-20 15:54:10 detected binary path: /usr/local/bin/uwsgi
2020-04-20 15:54:10 *** dumping internal routing table ***
2020-04-20 15:54:10 [rule: 0] subject: path_info regexp: \.svgz$ action: addheader:Content-Encoding:gzip
2020-04-20 15:54:10 *** end of the internal routing table ***
2020-04-20 15:54:10 chdir() to /home/ABC123/
2020-04-20 15:54:10 limiting number of processes to 60...
2020-04-20 15:54:10 your processes number limit is 60
2020-04-20 15:54:10 your memory page size is 4096 bytes
2020-04-20 15:54:10 detected max file descriptor number: 123456
2020-04-20 15:54:10 building mime-types dictionary from file /etc/mime.types...
2020-04-20 15:54:10 552 entry found
2020-04-20 15:54:10 lock engine: pthread robust mutexes
2020-04-20 15:54:10 thunder lock: disabled (you can enable it with --thunder-lock)
2020-04-20 15:54:10 uwsgi socket 0 bound to UNIX address /var/sockets/ABC123.pythonanywhere.com/socket fd 3
2020-04-20 15:54:10 Python version: 3.7.5 (default, Nov 14 2019, 22:26:37)  [GCC 5.4.0 20160609]
2020-04-20 15:54:10 *** Python threads support is disabled. You can enable it with --enable-threads ***
2020-04-20 15:54:10 Python main interpreter initialized at 0x10bd320
2020-04-20 15:54:10 your server socket listen backlog is limited to 100 connections
2020-04-20 15:54:10 your mercy for graceful operations on workers is 60 seconds
2020-04-20 15:54:10 setting request body buffering size to 65536 bytes
2020-04-20 15:54:10 mapped 334256 bytes (326 KB) for 1 cores
2020-04-20 15:54:10 *** Operational MODE: single process ***
2020-04-20 15:54:10 initialized 38 metrics
2020-04-20 15:54:10 WSGI app 0 (mountpoint='') ready in 2 seconds on interpreter 0x10bd320 pid: 1 (default app)
2020-04-20 15:54:10 *** uWSGI is running in multiple interpreter mode ***
2020-04-20 15:54:10 gracefully (RE)spawned uWSGI master process (pid: 1)
2020-04-20 15:54:10 spawned uWSGI worker 1 (pid: 4, cores: 1)
2020-04-20 15:54:10 metrics collector thread started
2020-04-20 15:54:10 spawned 2 offload threads for uWSGI worker 1
2020-04-20 15:54:12 announcing my loyalty to the Emperor...

error.log

2020-04-20 15:54:12,530: 200 GET / (10.0.0.121) 9.19ms
2020-04-20 15:54:19,930: 200 GET / (10.0.0.121) 4.68ms
2020-04-20 15:54:20,138: 404 GET /static/css/bootstrap.min.css (10.0.0.121) 0.38ms
2020-04-20 15:54:20,147: 404 GET /static/js/jquery.min.js (10.0.0.121) 0.27ms
2020-04-20 15:54:20,148: 404 GET /static/css/bootstrap-switch.min.css (10.0.0.121) 0.26ms
2020-04-20 15:54:20,148: 404 GET /static/css/bootstrap-theme.min.css (10.0.0.121) 0.21ms
2020-04-20 15:54:20,159: 404 GET /static/css/bootstrap-slider.min.css (10.0.0.121) 0.20ms
2020-04-20 15:54:20,160: 404 GET /static/css/visualization.css (10.0.0.121) 0.28ms
2020-04-20 15:54:20,249: 404 GET /static/js/bootstrap-switch.min.js (10.0.0.121) 0.30ms
2020-04-20 15:54:20,250: 404 GET /static/js/bootstrap.min.js (10.0.0.121) 0.40ms
2020-04-20 15:54:20,250: 404 GET /static/js/bootstrap-slider.min.js (10.0.0.121) 0.25ms
2020-04-20 15:54:20,251: 404 GET /static/js/d3.min.js (10.0.0.121) 0.25ms
2020-04-20 15:54:20,267: 404 GET /static/js/ChartModule.js (10.0.0.121) 0.24ms
2020-04-20 15:54:20,287: 404 GET /static/js/NetworkModule_d3.js (10.0.0.121) 0.23ms
2020-04-20 15:54:20,347: 404 GET /static/js/Chart.min.js (10.0.0.121) 0.30ms
2020-04-20 15:54:20,358: 404 GET /static/js/TextModule.js (10.0.0.121) 0.29ms
2020-04-20 15:54:20,359: 404 GET /static/js/runcontrol.js (10.0.0.121) 0.23ms
2020-04-20 15:54:20,390: 404 GET /static/js/bootstrap-switch.min.js (10.0.0.121) 0.23ms
2020-04-20 15:54:20,513: 404 GET /static/js/bootstrap-slider.min.js (10.0.0.121) 0.33ms
2020-04-20 15:54:20,628: 404 GET /static/js/d3.min.js (10.0.0.121) 0.32ms
2020-04-20 15:54:20,796: 404 GET /static/js/ChartModule.js (10.0.0.121) 0.31ms
2020-04-20 15:54:20,920: 404 GET /static/js/NetworkModule_d3.js (10.0.0.121) 0.32ms
2020-04-20 15:54:21,100: 404 GET /static/js/Chart.min.js (10.0.0.121) 0.29ms
2020-04-20 15:54:21,208: 404 GET /static/js/TextModule.js (10.0.0.121) 0.30ms
2020-04-20 15:54:21,331: 404 GET /static/js/runcontrol.js (10.0.0.121)  0.36ms

我觉得这几乎是成功的(我可能是错的,但是我对Web开发非常陌生。任何提示或建议将不胜感激。

javascript python-3.x tornado web-hosting pythonanywhere
1个回答
0
投票

如果我正确理解了设置,您也希望Tornado也提供静态文件;为此,您必须让它知道在哪里可以找到它们。试试:

© www.soinside.com 2019 - 2024. All rights reserved.