本地服务器提供了错误的文件.我可能正在运行2个python服务器吗? [英] Local server giving wrong files. Is it possible I'm running 2 python servers?

查看:74
本文介绍了本地服务器提供了错误的文件.我可能正在运行2个python服务器吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在目录/backbone/中,该目录在脚本中有一个main.js文件.我从backbone目录运行python -m SimpleHTTPServer并将其显示在浏览器中,控制台读取错误$ is not defined并引用了与我几天前在本地python服务器上工作的文件完全不同的main.js文件. /p>

我对此并不陌生,不知道发生了什么.如果有时间,会喜欢一些建议.

解决方案

只有一个进程可以监听端口.您不能在同一个端口上侦听两个SimpleHTTPServer进程.但是,您可以关闭旧服务器进程,然后忽略新服务器进程的启动失败或有关自动端口冲突解决的错误消息.

要调试此过程,请使用netstat(在OSX中为lsof,因为BSD netstat是la脚的)找到在端口上侦听的进程,然后使用'ps -fww'列出有关该进程的数据.您还可以查看/proc/$pid(linux)以获取进程ID的当前工作目录. lsof还可以帮助您跟踪进程在linux或BSD/OSX中打开的文件,如果您不确定它正在提供哪些文件.

希望有帮助!

I'm in the directory /backbone/ which has a main.js file within scripts. I run python -m SimpleHTTPServer from the backbone directory and display it in the browser and the console reads the error $ is not defined and references a completely different main.js file from something I was working on days ago with a local python server.

I am new to this and don't have an idea what's going on. Would love some suggestions if you have time.

解决方案

Only one process can listen on a port; you cannot have two SimpleHTTPServer processes listening on the same port. You can however leave an old server process up and then disregard failed startup of the new server process or error message about automatic port conflict resolution.

To debug this process, use netstat ( lsof in OSX, since BSD netstat is lame ) to find the process listening on the port and then 'ps -fww' to list data about that process. You can also take a look at /proc/$pid ( linux ) to get a process ID's current working directories. lsof can also help track down files the process has open in linux OR BSD/OSX if you're unsure which files it's serving.

Hope it helps!

这篇关于本地服务器提供了错误的文件.我可能正在运行2个python服务器吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆