django-swiftbrowser icon indicating copy to clipboard operation
django-swiftbrowser copied to clipboard

Bad Request(400) when I access on browser.

Open liuhaibinniu opened this issue 5 years ago • 3 comments

install use docker ,code use master branch,but my browser return 400 error。 docker logs contain compiled with version: 8.3.0 on 15 August 2019 07:37:03 os: Linux-3.10.0-957.10.1.el7.x86_64 #1 SMP Mon Mar 18 15:06:45 UTC 2019 nodename: 32982f09b247 machine: x86_64 clock source: unix pcre jit disabled detected number of CPU cores: 16 current working directory: /swiftbrowser detected binary path: /usr/local/bin/uwsgi *** WARNING: you are running uWSGI without its master process manager *** your processes number limit is 1048576 your memory page size is 4096 bytes detected max file descriptor number: 1048576 lock engine: pthread robust mutexes thunder lock: disabled (you can enable it with --thunder-lock) uWSGI http bound on :8000 fd 4 spawned uWSGI http 1 (pid: 8) uwsgi socket 0 bound to TCP address 127.0.0.1:37417 (port auto-assigned) fd 3 Python version: 3.5.7 (default, Aug 14 2019, 13:16:47) [GCC 8.3.0] *** Python threads support is disabled. You can enable it with --enable-threads *** Python main interpreter initialized at 0x562df425dc00 your server socket listen backlog is limited to 100 connections your mercy for graceful operations on workers is 60 seconds mapped 72920 bytes (71 KB) for 1 cores *** Operational MODE: single process *** WSGI app 0 (mountpoint='') ready in 2 seconds on interpreter 0x562df425dc00 pid: 1 (default app) *** uWSGI is running in multiple interpreter mode *** spawned uWSGI worker 1 (and the only) (pid: 1, cores: 1) [pid: 1|app: 0|req: 1/1] 10.20.66.184 () {38 vars in 642 bytes} [Fri Aug 16 05:03:04 2019] GET / => generated 26 bytes in 1646 msecs (HTTP/1.1 400) 1 headers in 53 bytes (1 switches on core 0)

liuhaibinniu avatar Aug 16 '19 03:08 liuhaibinniu

my system is centos7 ,python 3.7 Django 2.2

liuhaibinniu avatar Aug 16 '19 03:08 liuhaibinniu

Same here!

Figured it out. You need to set the ALLOWED_HOSTS environment variable to *.

e.g., in my docker-compose.yml, I have:

  swift:
     image: 'bouncestorage/swift-aio:latest'
     container_name: swift
     volumes:
      - ./swift-output:/swift/nodes
     ports:
       - 8080:8080
  django-swiftbrowser:
     image: 'mine/django-swiftbrowser'
     container_name: django-swiftbrowser
     ports:
       - 8888:8000
     environment:
      - SECRET_KEY=CHANGE_THIS_TO_SOME_RANDOM_VALUE
      - SWIFT_AUTH_VERSION=1
      - SWIFT_AUTH_URL=http://swift:8080/auth/v1.0
      - STORAGE_URL=http://swift:8080/v1
      - ALLOWED_HOSTS=*

Hope that helps!

The-Alchemist avatar Aug 21 '19 16:08 The-Alchemist

Same here! Figured it out. You need to set the ALLOWED_HOSTS environment variable to . e.g., in my docker-compose.yml, I have: swift: image: 'bouncestorage/swift-aio:latest' container_name: swift volumes: - ./swift-output:/swift/nodes ports: - 8080:8080 django-swiftbrowser: image: 'mine/django-swiftbrowser' container_name: django-swiftbrowser ports: - 8888:8000 environment: - SECRET_KEY=CHANGE_THIS_TO_SOME_RANDOM_VALUE - SWIFT_AUTH_VERSION=1 - SWIFT_AUTH_URL=http://swift:8080/auth/v1.0 - STORAGE_URL=http://swift:8080/v1 - ALLOWED_HOSTS=

Hope that helps!

thanks,change setttings.py set ALLOWED_HOSTS = ["*"], My problem has been solved

liuhaibinniu avatar Aug 22 '19 10:08 liuhaibinniu