How to Install Django-wiki on Ubuntu Server Latest?

Django-wiki is a powerful wiki engine that is built on the Django web framework. It is used to create custom wikis, documentation repositories, and knowledge bases. In this tutorial, we will show you how to install and set up django-wiki on an Ubuntu server.

Prerequisites

Before getting started with the installation process, ensure that you have the following requirements;

Step 1: Creating a Python Virtual Environment

A virtual environment is essential for keeping your system libraries separate. So the first thing we need to do is create a virtual environment for our django-wiki project. Follow the below steps to create a Python virtual environment.

sudo apt install python3-venv

Now, create a new Python virtual environment using the following command:

python3 -m venv wiki-env

And then, activate the environment with the command:

source wiki-env/bin/activate

Your terminal prompt will now include the virtual environment name (wiki-env).

Step 2: Install Django-Wiki and Dependencies

Once the virtual environment is activated, you can install django-wiki and all its dependencies using pip.

pip install django-wiki

Step 3: Create a Django Project and Wiki App

In this step, we will create a new Django project and then add a wiki application to it. Follow the below steps to do this.

Create a new Django project:

django-admin startproject mywiki
cd mywiki

Create a new application within the Django project:

python manage.py startapp wiki

Add the wiki application to your project's settings.py file:

INSTALLED_APPS = [
    ...
    'wiki',
    'django.contrib.staticfiles',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.admin',
    'django.contrib.messages',
]

Step 4: Create a Database

Before running the migration, you’ll need to allow Django to create a database. Make sure you have a MySQL server installed and accessible on your Ubuntu 20.04 system.

Create a new database:

sudo mysql -u root -p
CREATE DATABASE mywiki_db CHARACTER SET UTF8 COLLATE UTF8_BIN;
GRANT ALL PRIVILEGES ON mywiki_db.* TO 'mywiki_db_user'@'localhost' IDENTIFIED BY 'yoursecret';
FLUSH PRIVILEGES;
exit;

In my case, I have created a database 'mywiki_db,' and I have assigned a user with privileges to access it (user: mywiki_db_user and password: yoursecret).

Now, execute the following command to perform the database migration:

python manage.py migrate

Step 5: Run the Django Development Server

To run the Django development server, run the following command:

python manage.py runserver 0.0.0.0:8000

The command will start the Django development server on your ubuntu 20.04 server on port 8000.

You can now visit http://:8000/ to view the wiki homepage.

That’s it! You have successfully installed Django-wiki on your Ubuntu 20.04 server.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!