Deployment
We will use gunicorn and nginx in this guide but you can run FlaskBB with every WSGI-compatible server like uWSGI or gevent. nginx is just used as a reverse proxy.
gunicorn is an optional dependency, install it with uv:
$ uv sync --extra gunicorn
and run FlaskBB using the gunicorn command:
$ uv run gunicorn wsgi:flaskbb --log-file logs/gunicorn.log --pid gunicorn.pid -w 4
To stop FlaskBB, just send a KILL signal to gunicorn.
kill `cat gunicorn.pid`
In addition to gunicorn we also need to start celery. Celery is a task queue that FlaskBB uses to send non blocking emails.
$ uv run flaskbb celery worker
Below is a example configuration for nginx. In this configuration all static files will be served via nginx.
server {
listen 80;
server_name forums.flaskbb.com;
access_log /var/log/nginx/access.forums.flaskbb.log;
error_log /var/log/nginx/error.forums.flaskbb.log;
location / {
try_files $uri @flaskbb;
}
# Static files
location /static {
alias /var/apps/flaskbb/flaskbb/static/;
}
location ~ ^/_themes/([^/]+)/(.*)$ {
alias /var/apps/flaskbb/flaskbb/themes/$1/static/$2;
}
# robots.txt
location /robots.txt {
alias /var/apps/flaskbb/flaskbb/static/robots.txt;
}
location @flaskbb {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
#proxy_set_header SCRIPT_NAME /forums; # This line will make flaskbb available on /forums;
proxy_redirect off;
proxy_buffering off;
proxy_pass http://127.0.0.1:5000;
}
}
For other deployment options, visit the full-fledged documentation here.