Skip to content

Instantly share code, notes, and snippets.

@changsijay
Last active August 29, 2015 13:56
Show Gist options
  • Save changsijay/9109098 to your computer and use it in GitHub Desktop.
Save changsijay/9109098 to your computer and use it in GitHub Desktop.
django-wiki
# official site: https://github.com/benjaoming/django-wiki
$ sudo apt-get install python-pip python-dev
# don't use `pip install wiki`, cuz has some bug. Using latest from git.
$ sudo pip install git+git://github.com/benjaoming/django-wiki.git
# check installed packages, where django-wiki is wiki (0.0.23)
$ pip list
argparse (1.2.1)
chardet (2.0.1)
Django (1.6.2)
django-classy-tags (0.4)
django-mptt (0.6.0)
django-sekizai (0.7)
fpconst (0.7.2)
Markdown (2.4)
Pillow (2.3.0)
pip (1.4.1)
python-apt (0.9.1)
python-debian (0.1.21-nmu2)
python-debianbts (1.11)
reportbug (6.5.0)
setuptools (2.1)
six (1.5.2)
SOAPpy (0.12.0)
sorl-thumbnail (11.12)
South (0.8.4)
wiki (0.0.23)
wsgiref (0.1.2)
$ django-admin.py startproject mysite
$ cd mysite/
# modify INSTALLED_APPS and TEMPLATE_CONTEXT_PROCESSORS and SITE_ID as below
$ vim mysite/settings.py
#modify as below
INSTALLED_APPS = (
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'south',
'django_notify',
'mptt',
'sekizai',
'sorl.thumbnail',
'wiki',
'wiki.plugins.attachments',
'wiki.plugins.notifications',
'wiki.plugins.images',
'wiki.plugins.macros',
)
#add as below
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.request",
"django.core.context_processors.static",
"django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages",
"sekizai.context_processors.sekizai",
)
SITE_ID = 1
$ vim mysite/urls.py
from django.conf.urls import patterns, include, url
from django_notify.urls import get_pattern as get_notify_pattern
from wiki.urls import get_pattern as get_wiki_pattern
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'mysite.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
(r'^notify/', get_notify_pattern()),
(r'', get_wiki_pattern()),
)
$ python manage.py syncdb
Would you like to create one now? (yes/no):yes
...your first account setting
$ python manage.py migrate
# visit http://127.0.0.1:8000/
"""
Django settings for mysite project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'f5=57_kui$z6tveu_vdzoyzjg*tcc^qhan36#979duh53jq@yk'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'south',
'django_notify',
'mptt',
'sekizai',
'sorl.thumbnail',
'wiki',
'wiki.plugins.attachments',
'wiki.plugins.notifications',
'wiki.plugins.images',
'wiki.plugins.macros',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'mysite.urls'
WSGI_APPLICATION = 'mysite.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/
STATIC_URL = '/static/'
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.request",
"django.core.context_processors.static",
"django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages",
"sekizai.context_processors.sekizai",
)
SITE_ID = 1
from django.conf.urls import patterns, include, url
from django_notify.urls import get_pattern as get_notify_pattern
from wiki.urls import get_pattern as get_wiki_pattern
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'mysite.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
(r'^notify/', get_notify_pattern()),
(r'', get_wiki_pattern()),
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment