Help for "Ticket: Connection"

I saw this error “AttributeError: ‘Blueprint’ object has no attribute ‘json_encoder’” in the “python” console.

In the http://localhost:5000/status page. It is shown like this:

Can someone tell me what could be wrong with my setup? Thanks!

Chris Lee

you have to give us more then that.
looks like you have missed some step(s) in the Readme section
Show us your.ini file at least (edit out your cluster URL)


Hi torus_ot,

Thanks a lot for helping me. Here is my .ini file. My setup is on windows 10 environment:

SECRET_KEY = super_secret_key_you_should_change
MFLIX_DB_URI = mongodb+srv://
MFLIX_NS = sample_mflix

SECRET_KEY = super_secret_testing_key
MFLIX_DB_URI = mongodb+srv://
MFLIX_NS = sample_mflix

When I run the following unit test, it seems it is fine. Here is the output:

C:\clee\mongo\class\m122p\mflix-python>pytest -m connection
============================= test session starts =============================
platform win32 – Python 3.7.3, pytest-3.3.0, py-1.8.0, pluggy-0.6.0
rootdir: C:\clee\mongo\class\m122p\mflix-python, inifile:
plugins: remotedata-0.3.1, openfiles-0.3.2, flask-0.10.0, doctestplus-0.3.0, arraydiff-0.3
collected 43 items

tests\ … [100%]

============================= 39 tests deselected =============================
=================== 4 passed, 39 deselected in 6.71 seconds ===================

However, when I run the integrated testing. I have the following error:


  • Restarting with stat
  • Debugger is active!
  • Debugger PIN: 295-745-842
  • Running on (Press CTRL+C to quit) - - [21/Sep/2019 14:08:44] “GET /status HTTP/1.1” 200 - - - [21/Sep/2019 14:08:44] “GET /static/css/main.d2c98b4b.chunk.css HTTP/1.1” 304 - - - [21/Sep/2019 14:08:44] “GET /static/js/1.18f02ebe.chunk.js HTTP/1.1” 304 - - - [21/Sep/2019 14:08:44] “GET /static/js/main.a01f0687.chunk.js HTTP/1.1” 304 - - - [21/Sep/2019 14:08:45] “GET /static/media/mongoleaf.0ebc1843.png HTTP/1.1” 304 - - - [21/Sep/2019 14:08:45] “GET /static/media/pixelatedLeaf.6c93bd20.svg HTTP/1.1” 304 - - - [21/Sep/2019 14:08:46] “GET /favicon.ico HTTP/1.1” 200 - - - [21/Sep/2019 14:08:46] “GET /manifest.json HTTP/1.1” 200 - - - [21/Sep/2019 14:09:02] “GET /api/v1/movies/ HTTP/1.1” 500 -
    Traceback (most recent call last):
    File “C:\ProgramData\Anaconda3\lib\site-packages\flask\”, line 1997, in call
    return self.wsgi_app(environ, start_response)
    File “C:\ProgramData\Anaconda3\lib\site-packages\flask\”, line 1978, in wsgi_app
    File “C:\ProgramData\Anaconda3\lib\site-packages\flask\”, line 332, in push
    self.session =
    File “C:\ProgramData\Anaconda3\lib\site-packages\flask\”, line 912, in open_session
    return self.session_interface.open_session(self, request)
    File “C:\ProgramData\Anaconda3\lib\site-packages\flask\”, line 324, in open_session
    s = self.get_signing_serializer(app)
    File “C:\ProgramData\Anaconda3\lib\site-packages\flask\”, line 321, in get_signing_serializer
    File “C:\ProgramData\Anaconda3\lib\site-packages\itsdangerous\”, line 95, in init
    self.is_text_serializer = is_text_serializer(serializer)
    File “C:\ProgramData\Anaconda3\lib\site-packages\itsdangerous\”, line 13, in is_text_serializer
    return isinstance(serializer.dumps({}), text_type)
    File “C:\ProgramData\Anaconda3\lib\site-packages\flask\”, line 85, in dumps
    return json.dumps(tag(value), separators=(’,’, ‘:’))
    File "C:\ProgramData\Anaconda3\lib\site-packages\flask\json_init
    .py", line 209, in dumps
    dump_arg_defaults(kwargs, app=app)
    File "C:\ProgramData\Anaconda3\lib\site-packages\flask\json_init
    .py", line 119, in _dump_arg_defaults
    “cls”, bp.json_encoder if bp and bp.json_encoder else app.json_encoder
    AttributeError: ‘Blueprint’ object has no attribute ‘json_encoder’

I am wondering if anyone knows what is wrong with my setup. Thanks a lot!

Chris Lee

Try to add your IP in whitelist in Atlas.

Also check that you correctly install sample databases

Can you try access your cluster from mongo shell?

Hi Yuliaya_68332 and torus_ot,

Thanks a lot for your help! Yes, I can connect to the database with mongo shell. But for some reason, when I ran the integration test, I kept getting the same error, even though the unit test was passed.

I finally set up everything on my old notebook which is running Windows 7, then everything works! Maybe there is some problem with Windows 10, or maybe I didn’t do everything right in Windows 10 environment. Anyway, I proceed with my assignment using the old notebook. Thanks you all !

Chris Lee