在我的App组件中,我有:
<Switch>
<Route exact path="/" render={() => <Redirect to="/en"/> }
/>
<Route path="/:lang(en|sv|fr)" component={Master} />
<Route component={PageNotFound} />
</Switch>
如果我转到mysite.com/en
,则路径成功匹配激活主组件的路由。
但是,如果我转到主域(“ /”),则url重定向到mysite.com/en
,但是Master组件未激活,因此不会呈现任何内容。为什么?
答案 0 :(得分:0)
已编辑:
这对我有用。你可以试试看。
[2018-09-06 03:14:47 -0300] [18008] [DEBUG] Current configuration:
proxy_protocol: False
worker_connections: 1000
statsd_host: None
max_requests_jitter: 0
post_fork: <function post_fork at 0x104710050>
errorlog: -
enable_stdio_inheritance: False
worker_class: sync
ssl_version: 2
suppress_ragged_eofs: True
syslog: False
syslog_facility: user
when_ready: <function when_ready at 0x1047101b8>
pre_fork: <function pre_fork at 0x1047100c8>
cert_reqs: 0
preload_app: False
keepalive: 5
accesslog: -
group: 20
graceful_timeout: 30
do_handshake_on_connect: False
spew: False
workers: 16
proc_name: None
sendfile: None
pidfile: None
umask: 0
on_reload: <function on_reload at 0x1046eea28>
pre_exec: <function pre_exec at 0x104710140>
worker_tmp_dir: None
limit_request_fields: 100
pythonpath: None
on_exit: <function on_exit at 0x1046f4c80>
config: gconfig.py
logconfig: None
check_config: False
statsd_prefix:
secure_scheme_headers: {'X-FORWARDED-PROTOCOL': 'ssl', 'X-FORWARDED-PROTO': 'https', 'X-FORWARDED-SSL': 'on'}
reload_engine: auto
proxy_allow_ips: ['127.0.0.1']
pre_request: <function pre_request at 0x1046f45f0>
post_request: <function post_request at 0x1046f46e0>
forwarded_allow_ips: ['127.0.0.1']
worker_int: <function worker_int at 0x104710230>
raw_paste_global_conf: []
threads: 1
max_requests: 0
chdir: /Users/me/Documents/Code/Apps/app
daemon: False
user: 501
limit_request_line: 4094
access_log_format: %(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"
certfile: None
on_starting: <function on_starting at 0x1046ee8c0>
post_worker_init: <function post_worker_init at 0x1046f4050>
child_exit: <function child_exit at 0x1046f4848>
worker_exit: <function worker_exit at 0x1046f49b0>
paste: None
default_proc_name: app:app
syslog_addr: unix:///var/run/syslog
syslog_prefix: None
ciphers: TLSv1
worker_abort: <function worker_abort at 0x1047102a8>
loglevel: debug
bind: ['127.0.0.1:8080']
raw_env: []
initgroups: False
capture_output: False
reload: False
limit_request_field_size: 8190
nworkers_changed: <function nworkers_changed at 0x1046f4b18>
timeout: 120
keyfile: None
ca_certs: None
tmp_upload_dir: None
backlog: 2048
logger_class: gunicorn.glogging.Logger
[2018-09-06 03:14:47 -0300] [18008] [INFO] Starting gunicorn 19.7.1
[2018-09-06 03:14:47 -0300] [18008] [DEBUG] Arbiter booted
[2018-09-06 03:14:47 -0300] [18008] [INFO] Listening at: http://127.0.0.1:8080 (18008)
[2018-09-06 03:14:47 -0300] [18008] [INFO] Using worker: sync
[2018-09-06 03:14:47 -0300] [18008] [INFO] Server is ready. Spawning workers
[2018-09-06 03:14:47 -0300] [18011] [INFO] Booting worker with pid: 18011
[2018-09-06 03:14:47 -0300] [18011] [INFO] Worker spawned (pid: 18011)
[2018-09-06 03:14:47 -0300] [18012] [INFO] Booting worker with pid: 18012
[2018-09-06 03:14:47 -0300] [18012] [INFO] Worker spawned (pid: 18012)
[2018-09-06 03:14:47 -0300] [18013] [INFO] Booting worker with pid: 18013
[2018-09-06 03:14:47 -0300] [18013] [INFO] Worker spawned (pid: 18013)
[2018-09-06 03:14:47 -0300] [18014] [INFO] Booting worker with pid: 18014
[2018-09-06 03:14:47 -0300] [18014] [INFO] Worker spawned (pid: 18014)
[2018-09-06 03:14:47 -0300] [18015] [INFO] Booting worker with pid: 18015
[2018-09-06 03:14:47 -0300] [18015] [INFO] Worker spawned (pid: 18015)
[2018-09-06 03:14:47 -0300] [18016] [INFO] Booting worker with pid: 18016
[2018-09-06 03:14:47 -0300] [18016] [INFO] Worker spawned (pid: 18016)
[2018-09-06 03:14:48 -0300] [18017] [INFO] Booting worker with pid: 18017
[2018-09-06 03:14:48 -0300] [18017] [INFO] Worker spawned (pid: 18017)
[2018-09-06 03:14:48 -0300] [18018] [INFO] Booting worker with pid: 18018
[2018-09-06 03:14:48 -0300] [18018] [INFO] Worker spawned (pid: 18018)
[2018-09-06 03:14:48 -0300] [18019] [INFO] Booting worker with pid: 18019
[2018-09-06 03:14:48 -0300] [18019] [INFO] Worker spawned (pid: 18019)
[2018-09-06 03:14:48 -0300] [18020] [INFO] Booting worker with pid: 18020
[2018-09-06 03:14:48 -0300] [18020] [INFO] Worker spawned (pid: 18020)
[2018-09-06 03:14:48 -0300] [18021] [INFO] Booting worker with pid: 18021
[2018-09-06 03:14:48 -0300] [18021] [INFO] Worker spawned (pid: 18021)
[2018-09-06 03:14:48 -0300] [18022] [INFO] Booting worker with pid: 18022
[2018-09-06 03:14:48 -0300] [18022] [INFO] Worker spawned (pid: 18022)
[2018-09-06 03:14:48 -0300] [18023] [INFO] Booting worker with pid: 18023
[2018-09-06 03:14:48 -0300] [18023] [INFO] Worker spawned (pid: 18023)
[2018-09-06 03:14:48 -0300] [18024] [INFO] Booting worker with pid: 18024
[2018-09-06 03:14:48 -0300] [18024] [INFO] Worker spawned (pid: 18024)
[2018-09-06 03:14:48 -0300] [18025] [INFO] Booting worker with pid: 18025
[2018-09-06 03:14:48 -0300] [18025] [INFO] Worker spawned (pid: 18025)
[2018-09-06 03:14:48 -0300] [18026] [INFO] Booting worker with pid: 18026
[2018-09-06 03:14:48 -0300] [18026] [INFO] Worker spawned (pid: 18026)
[2018-09-06 03:14:48 -0300] [18008] [DEBUG] 16 workers