Comments (2)
Dear All, any ideas how to fix it?
from flask-admin.
No the issue cannot be resolved by use_setinputsizes=False. It is not working. I tried the following code. Not working at all
import argparse
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_admin import Admin
from flask_admin.contrib.sqla import ModelView
from sqlalchemy import create_engine
app = Flask(__name__)
# Setup the Flask app
app.config['SECRET_KEY'] = 'mysecret'
app.config['SQLALCHEMY_DATABASE_URI'] = "YOUR SQL SERVER DB connection"
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
# Optionally, if you want to perform some operations directly with the engine, you can create it like this:
engine = create_engine(app.config['SQLALCHEMY_DATABASE_URI'], echo=True, use_setinputsizes=False)
class User(db.Model):
__tablename__ = 'user'
__table_args__ = {'schema': 'DevApp'}
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(150), unique=True)
email = db.Column(db.String(150))
admin = Admin(app, name='My App Admin', template_mode='bootstrap3')
admin.add_view(ModelView(User, db.session))
def create_db():
"""Creates the database tables."""
with app.app_context():
db.create_all()
print('Database tables created successfully.')
def drop_db():
"""Drops the database tables."""
with app.app_context():
db.drop_all()
print('Database tables dropped successfully.')
def run_app():
app.run(debug=True)
def main():
parser = argparse.ArgumentParser(description="Manage the Flask application.")
parser.add_argument('command', choices=['run', 'create_db', 'drop_db'],
help='the command to run')
args = parser.parse_args()
if args.command == 'run':
run_app()
elif args.command == 'create_db':
create_db()
elif args.command == 'drop_db':
drop_db()
if __name__ == '__main__':
main()
from flask-admin.
Related Issues (20)
- AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS' HOT 2
- AttributeError: object has no attribute '_data' for composite keys
- Add Button in Flask admin page HOT 1
- Flask-admin with React HOT 1
- get_list search HOT 1
- Pop up modal custom
- Add new field and remove other when selecting element
- ItemsRequired validator AttributeError: 'QuerySelectMultipleField' object has no attribute 'entries'
- Vendored Moment.js is vulnerable to directory traversal and redos attacks HOT 2
- HTTP 500 in FileAdmin if there are broken symlinks HOT 1
- set favicon HOT 1
- not compatible with `WTForms-3.1.0` and `Babel-2.13.0` HOT 3
- Flask Admin Incompatible With Modern Flask ( >=2.3) HOT 1
- Request for Enhanced Documentation on Overriding ajax_update in Flask-Admin
- mongodb form_subdocument overwrite stopped working after updates to current flask/ flask-admin/ flask-mongoenine HOT 1
- Multiple selection from dropdown list. HOT 1
- Problem with scoped_session by sqlalchemy
- RFE: migrate from `flask-babelex` to `flask-babel`
- Bootstrap4: Duplicate requests when opening modal windows
- Intercepting and executing custom code on object creation/update in flask-admin HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flask-admin.