简体   繁体   中英

ImportError: attempted relative import beyond top-level package in django

Trying to use this Invoice function of first app model (image below)

First App Model function

Here I am trying to use first app model Invoice function in second app (Image link below)

Second App view function

It show an Import Error (image below)

Error Image

I am trying to use one app model function in other app model function but it show an ImportError.

Each Django App contains an __init__.py file, registering them as a package. These "packages" can't import things from other files. To solve this, just put the view function in the same app as the model.

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