Skip to content

luismoralesp/X-LBForum

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LBForum

LBForum is a quick and simple forum which uses the Django Framework (written in Python language). LBForum is a reusable Django application, can be added to any existing django project. LBForum is distributed under the BSD and GPL license.

Demo site(Skin FluxBB): http://vik.haoluobo.com/lbforum/ Demo site(Skin V2EX): http://vik.haoluobo.com/lbforum2/

Demo site's source: https://github.com/vicalloy/lbforum-site

  • user-friendly installation process
  • the ease of integration into any Django project and the ease of installation
  • classic view of the forum like FluxBB
  • Allow users to upload attachments to their posts(by AJAX).
  • avatar support(Gravatar or user upload)
  • BBCode support
  • friendly edtor(by markItUp!).
  • Sticky threads (These threads are always sorted first in the list of threads)
  1. Install LBForum by easy_install or pip.

easy_install:

$ easy_install lbforum

pip:

$ pip install lbforum

Config urls.py:

(r'^attachments/', include('attachments.urls')),
(r'^', include('lbforum.urls')),

The LBForum has some settings should be set in settings.py:

  1. Add the following app to INSTALLED_APPS:

    'pagination',
    'south',
    'lbforum',
    'simpleavatar',
    'djangohelper',
    'onlineuser',
    'attachments',
    
  2. Add the following middleware to MIDDLEWARE_CLASSES:

    'pagination.middleware.PaginationMiddleware',
    'onlineuser.middleware.OnlineUserMiddleware',
    
  3. add "djangohelper.context_processors.ctx_config", to TEMPLATE_CONTEXT_PROCESSORS:

    TEMPLATE_CONTEXT_PROCESSORS = (
        "django.core.context_processors.auth",
        "django.core.context_processors.debug",
        "django.core.context_processors.i18n",
        "django.core.context_processors.media",
        "django.core.context_processors.static",
        "django.core.context_processors.request",
    
        "djangohelper.context_processors.ctx_config",
    )
    
  4. setting urls for lbforum:

    # URL prefix for lbforum media -- CSS, JavaScript and images. Make sure to use a
    # trailing slash.
    # Examples: "http://foo.com/media/", "/media/".
    
    #The URL where requests are redirected after login
    LOGIN_REDIRECT_URL = '/'
    #The URL where requests are redirected for login
    LOGIN_URL = "/accounts/login/"
    #LOGIN_URL counterpart
    LOGOUT_URL = "/accounts/logout/"
    #register url
    REGISTER_URL = '%saccounts/register/' % ROOT_URL
    
  5. vars for templates:

    CTX_CONFIG = {
            'LBFORUM_TITLE': 'LBForum',
            'LBFORUM_SUB_TITLE': 'A forum engine written in Python using Django',
            'FORUM_PAGE_SIZE': 50,
            'TOPIC_PAGE_SIZE': 20,
    
            'LOGIN_URL': LOGIN_URL,
            'LOGOUT_URL': LOGOUT_URL,
            'REGISTER_URL': REGISTER_URL,
            }
    
  6. settings for BBCODE:

    BBCODE_AUTO_URLS = True
    #add allow tags
    HTML_SAFE_TAGS = ['embed']
    HTML_SAFE_ATTRS = ['allowscriptaccess', 'allowfullscreen', 'wmode']
    #add forbid tags
    HTML_UNSAFE_TAGS = []
    HTML_UNSAFE_ATTRS = []
    
    """
    #default html safe settings
    acceptable_elements = ['a', 'abbr', 'acronym', 'address', 'area', 'b', 'big',
        'blockquote', 'br', 'button', 'caption', 'center', 'cite', 'code', 'col',
        'colgroup', 'dd', 'del', 'dfn', 'dir', 'div', 'dl', 'dt', 'em',
        'font', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img',
        'ins', 'kbd', 'label', 'legend', 'li', 'map', 'menu', 'ol',
        'p', 'pre', 'q', 's', 'samp', 'small', 'span', 'strike',
        'strong', 'sub', 'sup', 'table', 'tbody', 'td', 'tfoot', 'th',
        'thead', 'tr', 'tt', 'u', 'ul', 'var']
    acceptable_attributes = ['abbr', 'accept', 'accept-charset', 'accesskey',
        'action', 'align', 'alt', 'axis', 'border', 'cellpadding', 'cellspacing',
        'char', 'charoff', 'charset', 'checked', 'cite', 'clear', 'cols',
        'colspan', 'color', 'compact', 'coords', 'datetime', 'dir',
        'enctype', 'for', 'headers', 'height', 'href', 'hreflang', 'hspace',
        'id', 'ismap', 'label', 'lang', 'longdesc', 'maxlength', 'method',
        'multiple', 'name', 'nohref', 'noshade', 'nowrap', 'prompt',
        'rel', 'rev', 'rows', 'rowspan', 'rules', 'scope', 'shape', 'size',
        'span', 'src', 'start', 'summary', 'tabindex', 'target', 'title', 'type',
        'usemap', 'valign', 'value', 'vspace', 'width', 'style']
    """
    
  7. if you want to use skin v2ex, you should add the follow config to settings.py:

    #always show topic post in topic page.
    LBF_STICKY_TOPIC_POST = True
    #show last topic in index page
    LBF_LAST_TOPIC_NO_INDEX = True
    #add v2ex template dir to TEMPLATE_DIRS
    import lbforum
    V2EX_TEMPLATE_DIR = os.path.join(lbforum.__path__[0], 'templates_v2ex')
    TEMPLATE_DIRS = (
            os.path.join(HERE, 'templates_plus'),
            os.path.join(HERE, 'templates_v2ex'),
            V2EX_TEMPLATE_DIR,
    )
    
  1. Run command manage.py migrate

About

LBForum is a forum engine written in Python using Django

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 48.5%
  • CSS 31.5%
  • JavaScript 20.0%