Я запускаю свой код на Python 3.7 на Mac.
по какой-то причине, когда я пытаюсь запустить файл "run.py", он выводит эту ошибку:
Traceback (most recent call last):
File "/Users/sxxx/Desktop/python-project/aimupapp/routes.py", line 2, in <module>
from aimupapp import app
ModuleNotFoundError: No module named 'aimupapp'
[Finished in 0.7s with exit code 1]
[shell_cmd: python -u "/Users/sxxx/Desktop/python-project/aimupapp/routes.py"]
[dir: /Users/sxxx/Desktop/python-project/aimupapp]
[path: /Library/Frameworks/Python.framework/Versions/3.7/bin:/anaconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin]
Это моя структура папок:
├── aimupapp
│ ├── __init__.py
│ ├── __pycache__
│ ├── forms.py
│ ├── models.py
│ ├── routes.py
│ ├── site.db
│ ├── static
│ │ ├── bootstrap
│ │ ├── css
│ │ ├── img
│ │ └── main.css
│ └── templates
│ ├── index.html
│ ├── layout.html
│ ├── tutor.html
│ ├── ..
└── run.py
run.py
from aimupapp import app
if __name__ == '__main__':
app.run(debug=True)
__init__.py
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_bcrypt import Bcrypt
app = Flask(__name__)
app.config['SECRET_KEY'] = 'xxxx'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///site.db'
db = SQLAlchemy(app)
bcrypt = Bcrypt(app)
from aimupapp import routes
models.py
from aimupapp import db
routes.py
from flask import render_template, url_for, flash, redirect
from aimupapp import app
from aimupapp.forms import RegistrationForm, LoginForm
from aimupapp.models import User, Tutor