当使用别名为 localhost 的域(与 localhost 本身相比)时,本地 django 服务器的静态内容加载速度非常慢
我已将域添加到我的 /etc/hosts/ 文件中,并且我的站点可以解析,但是静态内容的加载速度痛苦缓慢。我说的是一个页面需要 30 秒,而从本地主机通常需要 0.8 秒。我不知道为什么会这样,它破坏了我的工作流程。我实际上格式化了我的机器,看看是否可以解决,但仍然没有运气。这是在最新版本的 Mac OS X 上。
因此, http://localhost:8000 很棒,非常快,而http://mydomain.com:8000 速度慢得令人痛苦。
我无法使用 localhost 或 127.0.0.1,因为它是一个使用 Facebook connect 的应用程序,而且他们最近停止允许这两个作为应用程序的有效 URL。
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
127.0.0.1 mydomain.com
I've added the domain to my /etc/hosts/ file, and my site resolves, however static content is loading painfully slow. I'm talking 30 seconds for a page that normally takes 0.8s from localhost. I have no idea why this is, and it's killing my workflow. I actually formatted my machine to see if that would resolve but still no luck. This is on the latest version of Mac OS X.
So, http://localhost:8000 is great, very fast, while http://mydomain.com:8000 is painfully slow.
I can't use localhost or 127.0.0.1 because it's an application that uses Facebook connect, and they recently stopped allowing both of those as valid URLs for applications.
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
127.0.0.1 mydomain.com
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会使用 SimpleHTTPServer 进行测试,看看问题是否与 Django 有关:
I'd test with the SimpleHTTPServer to see if the problem is related to Django or not: