New Flask Template
It’s also an interesting example of using docker for a flask project.
It’s also an interesting example of using docker for a flask project.
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
This required setting the following in my /etc/environment:
no_proxy=/var/run/docker.sock
I found that post very helpful. I didn’t know it’s a better idea to use a list comprehension rather than a generator expression for ““.join().
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.
https://github.com/mitsuhiko/flask/issues/801#issuecomment-21513278
If you’re using app.test_client().get, it’s very important to use a relative url or your parameters will be removed.
# will not pass request.args
rv = self.client.get('http://0.0.0.0:5000/view/?foo=bar')
# works just fine
rv = self.client.get('/view/?foo=bar')
That’s the most helpful guide I found for self-hosting your own fonts and preventing compatibility issues.
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).
If you make configuration changes, the changes will not take effect until you:
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
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.