无法通过以下网址访问Django服务器:http://127.0.0.1:8000 / [英] Can't access the Django server at http://127.0.0.1:8000/

查看:201
本文介绍了无法通过以下网址访问Django服务器:http://127.0.0.1:8000 /的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在解雇时,它工作得很好,但是现在显示此问题:

At firt time it worked totally fine but it is showing this issue now:

app$ python manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).
September 03, 2017 - 17:28:43
Django version 1.11.4, using settings 'aggregator.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

它说正在运行,但我无法在该地址访问它。

It says its running but I can't Access it on that address. What could have been possibly wrong?

我的docker-compose文件:

my docker-compose file:

    version: "2"

services:
  postgres:
    image: postgres:9.6
    volumes:
      - pgdata:/var/lib/data/postgres

  backend:
    build: .
    command: gosu app bash
    volumes:
      - .:/app
      - pyenv:/python
    links:
      - postgres:postgres
    ports:
      - 8000:8000

volumes:
  pyenv:
  pgdata:


推荐答案

要进行开发,您可以在settings.py中尝试

for develop you can try

ALLOWED_HOSTS = ['*']

然后

python manage.py runserver 0.0.0.0:8000

这篇关于无法通过以下网址访问Django服务器:http://127.0.0.1:8000 /的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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