简体   繁体   中英

Cannot connect to Flask-Eve API

I'm trying to use Eve to manipulate data on MongoDB. I followed the Eve's official instruction to test the result, then failed.

Eve's official instruction for quick-start

touch 2 files in a same document as below

#/run.py

from eve import Eve
app = Eve()

if __name__ == '__main__':
    app.run()
#/settings.py

DOMAIN = {'people': {}}

Result

Afterward I type $ python run.py to launch API in command line, and nothing happend. It should tell me the address as the official instruction told.

#It should be like this
$ python run.py
 * Running on http://127.0.0.1:5000/

$ curl -i http://127.0.0.1:5000
HTTP/1.0 200 OK
Content-Type: application/json
Content-Length: 82
Server: Eve/0.0.5-dev Werkzeug/0.8.3 Python/2.7.3
Date: Wed, 27 Mar 2013 16:06:44 GMT



#My situation
$ python run.py
 * nothing

$ curl -i http://127.0.0.1:5000
curl: (7) Failed to connect to 127.0.0.1 port 5000: Connection refused

I really have no idea how to deal with it.

Try following way and see if it works

#/run.py

from eve import Eve
from flask_sslify import SSLify

if __name__ == '__main__':
    app = Eve()
    app.run()

I had the same issue. I installed Flask-SSLify and it worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM