Searching non-text columns - Flask-Admin

Flask-Admin’s search box only worked on text columns. I had a ModelView showing usernames next to a related number, and to find a row by that number you had to set up a filter instead of just typing it into the search box.

So I loosened the search to accept non-text SQLAlchemy columns too (integers, dates, and so on), using ILIKE, which casts and matches across those types (#795). I added tests for searching integer columns on SQLite and MySQL, across SQLAlchemy 0.7 and 0.9.8.

class UserView(ModelView):
    column_searchable_list = ['username', 'account_number']  # account_number is an integer

mod_wsgi + Flask

Here’s my mod_wsgi configuration for a flask app that uses Flask-Admin.

Trailing slashes matter! If you set a trailing slash, it will only set the alias for that directory and not all of the directories below it.

Dokku Change Nginx Timeout

Updated 2026-09-26: reworked for Dokku’s nginx:set.

Dokku sets nginx’s proxy timeouts per app with nginx:set. The value needs a unit, and it only takes effect once you rebuild the app’s nginx config:

dokku nginx:set myapp proxy-read-timeout 300s
dokku proxy:build-config myapp

proxy-connect-timeout works the same way, and --global in place of the app name changes the default for every app (rebuild them with dokku proxy:build-config --all).

Supervisord Tips and Gotchas

If you make configuration changes, the changes will not take effect until you:

  • supervisorctl reread
  • supervisorctl update

redirect_stderr=true will cause both stderr and stdout to appear in the “stdout” log.

You get to select which user runs the command with the “user” parameter.

For example: user=root

Supervisord keeps its own set of environmental variables with the “environment” parameter. It won’t pick up env variables from /etc/environment.

For example: environment=A=”1”,B=”2”

For Gunicorn, use a configuration file rather than putting all your arguments into the “command” parameter.

For example: command=/path/to/gunicorn main:application -c /path/to/gunicorn.conf.py

Installing python-ldap on Dokku

Updated 2026-09-23: swapped python-dev for python3-dev.

Install this plugin: https://github.com/dokku-community/dokku-apt#installation

Create an apt-packages file in the root directory of your repository with the following lines:

python3-dev
libldap2-dev
libsasl2-dev
libssl-dev

Now, commit your new apt-packages file and python-ldap should install successfully.

I also had trouble installing pymssql, and got an error saying “_mssql.c:314:22: fatal error: sqlfront.h: No such file or directory”. Similar fix, just add “freetds-dev” to your apt-packages file.