Flask, циклический импорт PythonPython

Программы на Python
Anonymous
Flask, циклический импорт Python

Сообщение Anonymous »

Привет, я получаю сообщение **ImportError: невозможно импортировать имя «приложение» из частично инициализированного модуля «приложение» (скорее всего, из-за циклического импорта) **
мой каталог :< /p>
ICT239
|
приложение
|
_pycache
|
контроллеры
|
| - - - _pycache
| - - - Tours.py

|
модели
|
| - - - _pycache
| - - - ToursData.py

|
статический
|
| - - - CSS
| - - - img

| - - - js
|
шаблоны
|
venv
|
init.py
|
app.py
|
requirements.txt
app.py

Код: Выделить всё

 `from flask import render_template

from app import app

@app.route("/")
@app.route("/about")
def about():
return render_template("about.html")`
**
init.py**
`из фляги импорта колбы

Код: Выделить всё

from controllers.tours import toursBP

def create_app():
app = Flask(__name__)
app.config['SE']
app.register_blueprint(toursBP)

return app

app = create_app()`
tours.py:

Код: Выделить всё

`from flask import Blueprint,render_template
from models.toursData import Tour

toursBP = Blueprint("toursBP",__name__)

@toursBP.route("/tours")
def tours():
tours,countries = Tour.getAllToursBy()
print(tours)
return render_template("tours.html",tours =tours,countries = countries)`
кто-нибудь может помочь? Я не перешел к базе данных Mongoengine, и у меня всегда была ошибка. Сорри, все еще учусь ~

Подробнее здесь: https://stackoverflow.com/questions/790 ... lar-import

Вернуться в «Python»