#NIJI
NIJI is a forum APP for Django projects.
NIJI is developed with the idea that it should be easily integreated into existing Django projects
pip install -r requirements.txt
# CELERY SETTINGS
BROKER_URL = 'redis://localhost:6379/0'
CELERY_ACCEPT_CONTENT = ['json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
# Template context_processors
TEMPLATES[0]['OPTIONS']['context_processors'].append("niji.context_processors.niji_processor")
# Form UI Settings
CRISPY_TEMPLATE_PACK = 'bootstrap3'
INSTALLED_APPS = [
....
'django.contrib.humanize',
'crispy_forms',
'niji',
]
from django.conf.urls import url, include
from niji import urls as niji_urls
urlpatterns = [
...
url(r'', include(niji_urls, namespace="niji")),
]
from __future__ import absolute_import
import os
from celery import Celery
from django.conf import settings
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project_name.settings') # Change this to the project name
app = Celery('project_name')
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
from __future__ import absolute_import
from .celery import app as celery_app
celery -A project_name worker -l INFO
Django-pagedown editor is automatically enabled if you have pagedown
in your INSTALLED_APPS
In order not to break the layout and add an i18n tweak to the text "Preview", you'll need to include the following settings:
# Pagedown Editor
PAGEDOWN_WIDGET_CSS = ('pagedown/demo/browser/demo.css', "css/editor.css",)
PAGEDOWN_WIDGET_TEMPLATE = 'niji/widgets/pagedown.html'
NIJI_SITE_NAME = "xxx" # This will add "-xxx" to html title
Add the following to your settings
CELERY_EAGER_PROPAGATES_EXCEPTIONS = True
CELERY_ALWAYS_EAGER = True
BROKER_BACKEND = 'memory'
With these settings present, you don't need to run a seperate celery worker.
And the tasks will be executed in a synchronous manner.