**I've tried many Python modules such as marshmallow, flask-marshmallow,..., but none of them it seems to be working. I believe my set up is correct, but it could be wrong. I believe the marshmallow modules are not being recognized although I installed. **
import os
from flask import Flask, render_template, request, redirect, url_for, flash
from flask_sqlalchemy import SQLAlchemy
from flask_marshmallow import Marshmallow
from marshmallow import Schema, fields
app = Flask(__name__)
db = SQLAlchemy()
ma = Marshmallow(app)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db.init_app(app)
conn = sqlite3.connect('database.db')
class Users(db.Model):
__tablename__ = 'Users'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String)
email = db.Column(db.String)
username = db.Column(db.String)
def __init__(self,id,name,email,username):
self.id = id
self.name = name
self.email = email
self.username = username
class UsersSchema(ma.SQLAlchemyAutoSchema):
id = fields.Integer()
username = fields.String(required=True)
email = fields.String(required=True)
password = fields.String(required=True)
user_schema = UsersSchema()