小编Gro*_*nes的帖子

根组件的React/Redux调度操作?

我正在尝试使用带有React-Native/Redux的firebase我需要在每次用户登录或注销时发送操作.如何从根组件调度操作?

class App extends Component {
    componentWillMount() {
        firebase.auth().onAuthStateChanged((user) => {
            if (user) {
            // Dispatch Action here
            } else {
            // Disptach Action here
            }
        });
    }

    render() {
        const store = createStore(reducers, {}, applyMiddleware(ReduxThunk));

        return (
            <Provider store={store}>
                <Router />
            </Provider>
        );
    }
}

export default App;
Run Code Online (Sandbox Code Playgroud)

firebase reactjs react-native firebase-authentication redux

5
推荐指数
1
解决办法
4176
查看次数

如何从github pip安装.... powershell给出错误找不到命令'git'?

我正在尝试将psycopg2安装到我的virtualenv中.我试过pip我试过easy_install没有什么工作......从pip安装是更理想的选择,但它必须通过nwcell的github包来完成https://github.com/nwcell/psycopg2-windows heres the command我一直在用:

pip install git+https://github.com/nwcell/psycopg2-windows.git@win64-py34#egg=psycopg2
Run Code Online (Sandbox Code Playgroud)

python powershell pip psycopg2 virtualenv

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

Django SerializerDoesNotExist'geojson'?

我正在尝试以geojson格式序列化数据,但每当我使用时

json = serialize("geojson", coordinate.objects.all())
response = HttpResponse(json)
return response
Run Code Online (Sandbox Code Playgroud)

django给了我

SerializerDoesNotExist at/getmarkers /'geojson'

这很好用

json = serialize("json", coordinate.objects.all())
Run Code Online (Sandbox Code Playgroud)

当然,其他尝试过使用geojson序列化程序的人也遇到了同样的问题.我按照说明在文档中安装了GDAL库.有任何想法吗?似乎无法在文档中找到关于必须导入哪些模块的任何内容我已经尝试过了

from django.contrib.gis import gdal
Run Code Online (Sandbox Code Playgroud)

不会抛出错误但也无法解决我使用Django 1.8的问题

django serialization gdal geojson

3
推荐指数
1
解决办法
864
查看次数

用python下载pdf?

我正在编写一个脚本,使用正则表达式在页面上查找pdf链接然后下载所述链接.该脚本在我的个人目录中运行并正确命名文件,但它没有下载完整的pdf文件.pdf被拉,只有19kb,一个损坏的pdf,当它们应该是大约15mb

import urllib, urllib2, re

url = 'http://www.website.com/Products'
destination = 'C:/Users/working/'
website = urllib2.urlopen(url)
html = website.read()
links = re.findall('.PDF">.*_geo.PDF', html)

for item in links:
    DL = item[6:]
    DL_PATH = url + '/' + DL
    SV_PATH = destination + DL
    urllib.urlretrieve(DL_PATH, SV_PATH)
Run Code Online (Sandbox Code Playgroud)

url变量链接到包含所有pdf链接的页面.当您点击pdf链接时,它会转到"www.website.com/Products/NorthCarolina.pdf",它会在浏览器中显示pdf.我不确定是否因为这个我应该使用不同的python方法或模块

python pdf download

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