Структура:
├── main.py
└── my_project
├── __init__.py
├── models.py
├── views.py
main.py
from my_project import app
app.run()
__init__.py
from flask import Flask, redirect, render_template, request, url_for, redirect
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = DATABASE
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['SQLALCHEMY_COMMIT_ON_TEARDOWN'] = True
db = SQLAlchemy(app)
import project.views
models.py
from my_project import db
class Users(db.Model):
Id = db.Column(db.Integer, primary_key=True)
Login = db.Column(db.String(255), nullable=False)
class Checks(db.Model):
Id = db.Column(db.Integer, primary_key=True)
PasswordHash = db.Column(db.String(255), nullable=False)
views.py
from my_project import app
from my_project .models import Users, Checks
@app.route('/')
def index():
return 'hello habr'