I’m a fan of Python, as I’m learning the language I look for software that could serve me in a language that I can understand. I’ve always liked wikis and Django wiki by Benjamin Balder Bach seems to fit in.
This is a simple how to for basic local linux installation as Docs seems to be targeted at advanced Django users.
The Setup
First we create a directory to have all our files in and cd
into it:
mkdir wiki
cd wiki/
then we initiate a python virtual environment so the wiki can have it’s own packages separated from the system, then we activate the virtual environment. (you can deactivate it by just typing deactivate
)
python3 -m venv vevn
source vevn/bin/activate
We then install the wiki
Package using pip:
pip install wiki
Then we start a new Django project we may name it mywiki
django-admin startproject mywiki
Then we cd
into mywiki/mywiki
To modify both settings.py
and urls.py
Modifying config files
We add the following to lines under INSTALLED_APPS
section in settings.py
'django.contrib.sites.apps.SitesConfig',
'django.contrib.humanize.apps.HumanizeConfig',
'django_nyt.apps.DjangoNytConfig',
'mptt',
'sekizai',
'sorl.thumbnail',
'wiki.apps.WikiConfig',
'wiki.plugins.attachments.apps.AttachmentsConfig',
'wiki.plugins.notifications.apps.NotificationsConfig',
'wiki.plugins.images.apps.ImagesConfig',
'wiki.plugins.macros.apps.MacrosConfig',
We add the following under TEMPLATES
section in settings.py
'sekizai.context_processors.sekizai',
and we add this line at the bottom of the settings.py
file:
SITE_ID = 1
Then we modify urls.py
to add related imports and url patterns:
from django.contrib import admin
from django.urls import path, include
from django.conf.urls.static import static
from django.conf import settingsurlpatterns = [
path('admin/', admin.site.urls),
path('notifications/', include('django_nyt.urls')),
path('', include('wiki.urls'))
]urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Setting up database and running the server
Now we should have our basic settings setup and ready. We go to the parent mysite
dir which contains the manage.py
file using cd..
and we run the following commands.
We setup the database using:
./manage.py migrate
We create an admin (called superuser) to allow us to manage the wiki:
./manage.py createsuperuser
We now run the server:
./manage.py runserver
You can now visit the wiki on the following address in your browser
127.0.0.1:8000
You can shutdown the server using Ctrl-C
keypair