test fix
Browse filesFiles changed (4)
66 unmodified lines67686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111266 unmodified lines# Register test blueprint first (this should always work)logger.info("Registering test blueprint...")from .routes.test import test_bpapp.register_blueprint(test_bp)# Register other blueprintslogger.info("Registering other blueprints...")try:with app.app_context():logger.info("Importing auth blueprint...")from .routes.auth import auth_bplogger.info("Importing dashboard blueprint...")from .routes.dashboard import dashboard_bplogger.info("Importing API blueprint...")from .routes.api import api_bplogger.info("Importing compliance blueprint...")from .routes.compliance import compliance_bplogger.info("Importing Google Ads blueprint...")from .routes.google_ads import google_ads_bplogger.info("Registering auth blueprint...")app.register_blueprint(auth_bp)logger.info("Registering dashboard blueprint...")app.register_blueprint(dashboard_bp)logger.info("Registering API blueprint...")app.register_blueprint(api_bp)logger.info("Registering compliance blueprint...")app.register_blueprint(compliance_bp)logger.info("Registering Google Ads blueprint...")app.register_blueprint(google_ads_bp)except Exception as e:logger.error(f"Error registering blueprints: {e}")# Continue without all blueprints for debuggingpass# Add a simple route directly to the app@app.route('/')66 unmodified lines67686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112266 unmodified lines# Register test blueprint first (this should always work)logger.info("Registering test blueprint...")try:from .routes.test import test_bpapp.register_blueprint(test_bp)logger.info("Test blueprint registered successfully")except Exception as e:logger.error(f"Error registering test blueprint: {e}")# Register other blueprintslogger.info("Registering other blueprints...")# Try to register each blueprint individuallytry:logger.info("Importing and registering dashboard blueprint...")from .routes.dashboard import dashboard_bpapp.register_blueprint(dashboard_bp)logger.info("Dashboard blueprint registered successfully")except Exception as e:logger.error(f"Error registering dashboard blueprint: {e}")try:logger.info("Importing and registering API blueprint...")from .routes.api import api_bpapp.register_blueprint(api_bp)logger.info("API blueprint registered successfully")except Exception as e:logger.error(f"Error registering API blueprint: {e}")try:logger.info("Importing and registering compliance blueprint...")from .routes.compliance import compliance_bpapp.register_blueprint(compliance_bp)logger.info("Compliance blueprint registered successfully")except Exception as e:logger.error(f"Error registering compliance blueprint: {e}")try:logger.info("Importing and registering Google Ads blueprint...")from .routes.google_ads import google_ads_bpapp.register_blueprint(google_ads_bp)logger.info("Google Ads blueprint registered successfully")except Exception as e:logger.error(f"Error registering Google Ads blueprint: {e}")try:logger.info("Importing and registering auth blueprint...")from .routes.auth import auth_bpapp.register_blueprint(auth_bp)logger.info("Auth blueprint registered successfully")except Exception as e:logger.error(f"Error registering auth blueprint: {e}")# Add a simple route directly to the app@app.route('/')
12# app/models/__init__.py# This file makes the models directory a Python package1234567891011121314151617181920212223242526272829303132333435363738# app/models/__init__.py# This file makes the models directory a Python packagefrom app import dbfrom datetime import datetimefrom flask_login import UserMixinfrom werkzeug.security import generate_password_hash, check_password_hashclass User(UserMixin, db.Model):id = db.Column(db.Integer, primary_key=True)email = db.Column(db.String(120), unique=True, nullable=False)password = db.Column(db.String(128), nullable=False)role = db.Column(db.String(20), default="viewer")created_at = db.Column(db.DateTime, default=datetime.utcnow)updated_at = db.Column(db.DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)def __repr__(self):return f'<User {self.email}>'def set_password(self, password):self.password = generate_password_hash(password)def check_password(self, password):return check_password_hash(self.password, password)class Ad(db.Model):id = db.Column(db.String(36), primary_key=True)content = db.Column(db.Text)sentiment = db.Column(db.JSON)ad_metadata = db.Column(db.JSON)user_id = db.Column(db.Integer, db.ForeignKey('user.id'))versions = db.relationship('AdVersion', backref='ad')class AdVersion(db.Model):id = db.Column(db.Integer, primary_key=True)ad_id = db.Column(db.String(36), db.ForeignKey('ad.id'))content = db.Column(db.Text)timestamp = db.Column(db.DateTime, default=datetime.utcnow)
1 unmodified line2345671 unmodified linefrom flask_login import login_user, logout_user, login_requiredfrom ..models import Userfrom ..forms import LoginForm, RegistrationFormauth_bp = Blueprint('auth', __name__)1 unmodified line23456781 unmodified linefrom flask_login import login_user, logout_user, login_requiredfrom ..models import Userfrom ..forms import LoginForm, RegistrationFormfrom app import dbauth_bp = Blueprint('auth', __name__)
app/__init__.py+45-35
app/models/__init__.py+37-1
app/models/google_ad.py
app/routes/auth.py+1