In this guide, we’re going to look at How to Setup Askbot Questions and Answers Framework on Ubuntu 18.04. Askbot is an open source question and answers web forum with a look similar to StackOverflow. Askbot is based on Django framework and most parts are written in Python programming language with some good features like a karma-based system, voting, and content moderation.

Askbot is used by Ask-FedoraProject and Ask-OpenStack projects to enable its users to ask questions and let other members of the community contribute.

In our installation of Askbot on Ubuntu 18.04, we will setup below prerequisites:

  • Database server – MySQL/MariaDB/PostgreSQL
  • uWSGI
  • Web Server – Nginx

Step 1: Install Askbot Dependencies

Start by installing all required dependencies, this will be python packages and pip package manager.

Update and upgrade system packages:

sudo apt-get update && sudo apt-get upgrade

Install python dependencies:

sudo apt-get install -y python-dev python-setuptools python-pip libmysqlclient-dev

Step 2: Install and Configure Database

For a database server, we’ll use MariaDB database server. Refer to our guide below for how to install and configure MariaDB database server on Ubuntu 18.04: Install MariaDB 10.3 on Ubuntu 18.04 and CentOS 7

If you’re interested in using MySQL Server, check Installing MySQL Server on CentOS 7 / CentOS 6

Once the database server has been installed, Create a database and associated user for Askbot:

[email protected]:~# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 21
Server version: 10.3.7-MariaDB-1:10.3.7+maria~bionic binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> CREATE DATABASE askbot_db;
Query OK, 1 row affected (0.000 sec)
MariaDB [(none)]> create user [email protected] identified by 'Password';
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> grant all privileges on askbot_db.* to [email protected];
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> exit

Step 3: Install and Configure Askbot

Now that we have installed the packages we need to install Askbot, and we have a database ready, let us install Askbot application. We will use Python Virtualenv for this.

Start by creating askbot user:

[email protected]:~# adduser askbot
Adding user `askbot' ...
Adding new group `askbot' (1000) ...
Adding new user `askbot' (1000) with group `askbot' ...
Creating home directory `/home/askbot' ...
Copying files from `/etc/skel' ...
New password: 
Retype new password: 
passwd: password updated successfully
Changing the user information for askbot
Enter the new value, or press ENTER for the default
Full Name []: 
Room Number []: 
Work Phone []: 
Home Phone []: 
Other []: 
Is the information correct? [Y/n] y
[email protected]:~# id askbot
uid=1000(askbot) gid=1000(askbot) groups=1000(askbot)

Add askbot user to sudo group:

$ sudo usermod -aG sudo askbot

Install virtualenv:

$ sudo pip install virtualenv
Collecting virtualenv
Downloading (1.9MB)
100% |████████████████████████████████| 1.9MB 526kB/s 
Installing collected packages: virtualenv
Successfully installed virtualenv-16.0.0

Create a directory for Askbot content:

# mkdir /srv/askbot
# chown askbot:askbot /srv/askbot/
# su - askbot
$ cd /srv/askbot/

After installing virtualenv package, create a Virtual environment for askbot:

$ virtualenv venv
New python executable in /srv/askbot/venv/bin/python
Installing setuptools, pip, wheel...done.

Source the env to start using it:

$ cd venv/
$ [email protected]:/srv/askbot/venv$ source bin/activate
(venv) [email protected]:/srv/askbot/venv$

Then install askbot and mysql python module:

$ pip install askbot gunicorn mysqlclient mysql-python

Setup Askbot:

(venv) [email protected]:/srv/askbot/venv$ mkdir askbot-app
(venv) [email protected]:/srv/askbot/venv$ cd askbot-app

Run the command askbot-setup to install askbot.

(venv) [email protected]:/srv/askbot/venv/askbot-app$ askbot-setup

Deploying Askbot - Django Q&A forum application
Problems installing? -> please email [email protected]

To CANCEL - hit Ctr-C at any time

Enter directory path (absolute or relative) to deploy
askbot. To choose current directory - enter "."
> .

Please select database engine:
1 - for postgresql, 2 - for sqlite, 3 - for mysql, 4 - oracle
type 1/2/3/4: 3

Please enter database name (required)
> askbot_db

Please enter database user (required)
> askbot

Please enter database password (required)
> Password
Copying files: 
* django.wsgi 
Creating settings file
settings file created

copying directories: * doc
* cron
* upfiles

Done. Please find further instructions at

Generate static files to AskBot installation directory:

$ python collectstatic

If you get an error like “TypeError: Error when calling the metaclass bases“, there is a fix for it. You need to install six version 1.10.0. Uninstall the latest version and install v1.10.0

(venv) [email protected]:/srv/askbot/askbot-app$ pip uninstall six 
(venv) [email protected]:/srv/askbot/askbot-app$ pip install six==1.10.0

When done, generate static files to AskBot installation directory:

$ python collectstatic

Type ‘yes‘ and press Enter to continue to finish generation of files.

Then run makemigrations and migrate commands

(venv) [email protected]:/srv/askbot/askbot-app$ python makemigrations
WARNING!!! You are using a 'locmem' (local memory) caching backend,
which is OK for a low volume site running on a single-process server.
For a multi-process configuration it is neccessary to have a production
cache system, such as redis or memcached.

With local memory caching and multi-process setup you might intermittently
see outdated content on your site.

System check identified some issues:

django_authopenid.UserPasswordQueue.user: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField.
HINT: ForeignKey(unique=True) is usually better served by a OneToOneField.
group_messaging.SenderList.recipient: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField.
HINT: ForeignKey(unique=True) is usually better served by a OneToOneField.
Migrations for 'askbot':
- Change Meta options on activity
- Change Meta options on award
- Change Meta options on badgedata
- Change Meta options on favoritequestion
- Change Meta options on postflagreason
- Change Meta options on postrevision
- Change Meta options on replyaddress
- Change Meta options on repute
- Change Meta options on threadtogroup
- Change Meta options on vote
- Alter field frequency on emailfeedsetting
- Alter field primary_language on userprofile

Generate the MySQL database with the optionmigrate.

(venv) [email protected]:/srv/askbot/askbot-app$ python migrate

You can also use:

$ python syncdb
Synchronizing apps without migrations:
Creating tables...
Running deferred SQL...
Installing custom SQL...
Running migrations:
No migrations to apply.
You have installed Django's auth system, and don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (leave blank to use 'askbot'): askbot
Email address: [email protected]
Password (again): 
Superuser created successfully.

When the script asks you if you want to create a superuser, answer yes if you want to create one. By default Askbot sets admin status(superuser) for the first user created automatically but also supports this form.

Test Askbot installation using:

(venv):/srv/askbot/askbot-app$ python runserver

Access your server IP and port 8080. If everything is okay, you should get to its dashboard below:

Step 5: Install and Configure uWSGI & Nginx

Install uWSGI from apt:

$ sudo apt-get install uwsgi

Create uwsgi configuration file for Askbot:

$ sudo vim /etc/uwsgi/apps-enabled/askbot.ini

Add content:


# uwsgi configurations
master = true
processes = 5
uid = www-data
listen.owner = www-data = www-data

# App configurations
socket = /srv/askbot/askbot.sock
chown-socket = www-data:www-data
chmod-socket = 664
vacuum = true
die-on-term = true
logto = /var/log/uwsgi.log
log-master-stream = true

Modify the file accordingly then save it.

Install nginx:
$ sudo apt-get install nginx

Restart uwsgi service with www-data  as socket file owner:

$ sudo systemctl restart uwsgi

Install certbot for generating Letsencrypt SSL Certificate:

# wget -P /usr/local/bin
# chmod a+x /usr/local/bin/certbot-auto

Generate Letsencrypt SSL certificate:

# systemctl stop nginx
# export DOMAIN=''
# export EMAIL="[email protected]"
# certbot-auto certonly --standalone -d $DOMAIN \
--preferred-challenges http --agree-tos -n -m $EMAIL \

If successful, certbot will give you a successful message:

Cleaning up challenges

 - Congratulations! Your certificate and chain have been saved at:
   Your key file has been saved at:
   Your cert will expire on 2018-09-28. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot-auto
   again. To non-interactively renew *all* of your certificates, run
   "certbot-auto renew"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:
   Donating to EFF:          

Create Nginx configuration file:

$ sudo vim /etc/nginx/conf.d/askbot.conf

Ensure you replace variables with your valid values then save the file.

# Askbot Nginx cofiguration

# cofiguration for https
server {
        listen 443 ssl http2;

        ssl on;
        ssl_certificate /etc/letsencrypt/live/;
        ssl_certificate_key /etc/letsencrypt/live/;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

        location /static {
          alias /srv/askbot/askbot-app/static;

        location / {
          include uwsgi_params;
          uwsgi_pass unix:/srv/askbot/askbot.sock;

# http to https redirect
server {
        listen 80;
        return    301 https://$server_name$request_uri;

Confirm that the syntax is okay:

$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Restart that both uwsgi and nginx services after making the change.

$ sudo systemctl restart uwsgi nginx