Skip to content

circular import between router.py and db.py #2

@Ruminateer

Description

@Ruminateer
$ flask run
 * Serving Flask app "router"
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
Usage: flask run [OPTIONS]

Error: While importing "router", an ImportError was raised:

Traceback (most recent call last):
  File "/home/zzy/.local/lib/python3.8/site-packages/flask/cli.py", line 240, in locate_app
    __import__(module_name)
  File "/home/zzy/src/Ruminateer/EventScheduler/router.py", line 14, in <module>
    import db
  File "/home/zzy/src/Ruminateer/EventScheduler/db.py", line 3, in <module>
    from router import app
ImportError: cannot import name 'app' from partially initialized module 'router' (most likely due to a circular import) (/home/zzy/src/Ruminateer/EventScheduler/router.py)

$ export FLASK_ENV=development
$ flask run
 * Serving Flask app "router" (lazy loading)
 * Environment: development
 * Debug mode: on
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 113-315-385
^C

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions