小编Mic*_* H.的帖子

pip需求说明符:逗号的作用

我正在尝试安装特定版本的django-cms,从而执行pip install django-cms==3.0.5.这给了我错误No matching distribution found for django-mptt==0.5.2,==0.6,==0.6.1 (from django-cms==3.0.5).事实上,在github上,setup.py文件指定了要求django-mptt==0.5.2,==0.6,==0.6.1.

规范指出,逗号作为逻辑"与"操作,但显然没有版本可以在同一时间是0.5.2,0.6和0.6.1,因此要求不匹配.只需通过pip install django-mptt==0.5.2工作安装其中一个版本没有问题,但仍然有关于django-cms == 3.0.5的相同错误.

任何人都可以阐明这一点吗?

python django pip django-cms python-2.7

8
推荐指数
1
解决办法
393
查看次数

在更改时反应路由器v4

我正在开发一个普通的React JS应用程序并使用BrowserRouter。我需要知道路线何时更改,而我发现的唯一内容是使用同一个人的历史记录包(反应训练)。

他们的例子看起来很简单,但对我来说根本不起作用:

import createHistory from 'history/createBrowserHistory'
const history = createHistory()

console.log('a')
history.listen((location, action) => {
    console.log(`The current URL is ${location.pathname}${location.search}${location.hash}`)
    console.log(`The last navigation action was ${action}`)
})


const A = props => <div>A <NavLink to="/b">b</NavLink></div>
const B = props => <div>B <NavLink to="/a">a</NavLink></div>

ReactDOM.render(
    <BrowserRouter>
        <div>
            <Route path="/a" component={A}/>
            <Route path="/b" component={B}/>
        </div>
    </BrowserRouter>,
    document.getElementById('app')
)
Run Code Online (Sandbox Code Playgroud)

控制台显示“ a”,但单击并更改URL时,永远不会调用监听回调。

他们的文档中没有更多内容,所以有人知道缺少什么吗?

reactjs react-router react-router-v4

2
推荐指数
1
解决办法
1271
查看次数