Giter Club home page Giter Club logo

lbforum's Introduction

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.

Demo site: http://lbf.haoluobo.com/

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

Features

  • 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
  • BBCode support
  • friendly edtor(by markItUp!).
  • Sticky threads (These threads are always sorted first in the list of threads)

Requirements

Installation

Installation

  1. Install LBForum by easy_install or pip.

easy_install:

$ easy_install lbforum

pip:

$ pip install lbforum

Configuration

Config urls.py:

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

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

  1. Add the following app to INSTALLED_APPS:

    'el_pagination',
    'easy_thumbnails',
    'constance',
    'constance.backends.database',
    'djangobower',
    
    'lbforum',
    'lbattachment',
    'lbutils',
  2. Add the following middleware to TEMPLATES['OPTIONS']['context_processors']:

    'django.contrib.messages.context_processors.messages',
  3. setting urls for lbforum:

    STATIC_URL = '/static/'
    STATIC_ROOT = os.path.join(PRJ_ROOT, 'collectedstatic')
    
    HOST_URL = ''
    MEDIA_URL_ = '/media/'
    MEDIA_URL = HOST_URL + MEDIA_URL_
    MEDIA_ROOT = os.path.join(PRJ_ROOT, 'media')
    
    SIGNUP_URL = '/accounts/signup/'
    LOGIN_URL = '/accounts/login/'
    LOGOUT_URL = '/accounts/logout/'
    LOGIN_REDIRECT_URL = '/'
    CHANGE_PASSWORD_URL = '/accounts/password/change/'
  4. settings for constance:

    CONSTANCE_BACKEND = 'constance.backends.database.DatabaseBackend'
    
    CONSTANCE_CONFIG = {
        'forbidden_words': ('', 'Forbidden words', str),
    }
  5. settings for bower:

    from django.conf.global_settings import STATICFILES_FINDERS
    STATICFILES_FINDERS += (('djangobower.finders.BowerFinder'),)
    
    BOWER_COMPONENTS_ROOT = PRJ_ROOT
    
    BOWER_INSTALLED_APPS = (
        'jquery#1.12',
        'markitup#1.1.14',
        'mediaelement#2.22.0',
        'blueimp-file-upload#9.12.5',
    )
  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']
    """

Initialize The Database & Static Files -----------------------

  1. Run command manage.py bower install
  2. Run command manage.py migrate

lbforum's People

Contributors

andrii-sherepa avatar baffolobill avatar catmidia avatar ddkangfu avatar imunizaga avatar kaysackey avatar nyafka avatar slepa avatar stereoit avatar vicalloy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lbforum's Issues

LBForumUserProfile matching query does not exist

今天尝试LBForum 和 mezzanine 1.2.4 进行整合,问题不大,遇到了上述问题,网上搜索,发现需要运行python manager.py init_lbforum_user_profile
但是这里的文档中没有写,希望补上~

然后还有就是LBForum的和mezzanine有些url上的冲突,主项目需要额外定义一个url,
认证登录模块基本登录、退出能用,注册会失败(404not found).

Error: index out of range

Under Django1.4.9

It attention me that in lbforum / templates_v2ex / lbforum / index.html
something wrong with the lines:
{ % lbforum_status % }

After I changed the last line of the file "lbforum / templatetags / lbforum_widget_tags.py" into
'last_registered_user': User.objects.order_by('-date_joined')}
everything seems OK.

IntegrityError when delete posts in admin page.

IntegrityError at /admin/lbforum/post/

(1452, 'Cannot add or update a child row: a foreign key constraint fails (lpardb.lbforum_topic, CONSTRAINT lbforum_topic_post_id_2d230e5a_fk_lbforum_post_id FOREIGN KEY (post_id) REFERENCES lbforum_post (id))')

Request Method: POST
Request URL: https://lpars.cn.ibm.com/admin/lbforum/post/
Django Version: 1.10.2
Exception Type: IntegrityError
Exception Value:

(1452, 'Cannot add or update a child row: a foreign key constraint fails (lpardb.lbforum_topic, CONSTRAINT lbforum_topic_post_id_2d230e5a_fk_lbforum_post_id FOREIGN KEY (post_id) REFERENCES lbforum_post (id))')

Exception Location: /usr/lib64/python2.7/site-packages/MySQLdb/connections.py in defaulterrorhandler, line 36
Python Executable: /usr/bin/python
Python Version: 2.7.8
Python Path:

['/usr/lib/python2.7/site-packages/django_bower-5.2.0-py2.7.egg',
'/usr/lib64/python27.zip',
'/usr/lib64/python2.7',
'/usr/lib64/python2.7/plat-linux2',
'/usr/lib64/python2.7/lib-tk',
'/usr/lib64/python2.7/lib-old',
'/usr/lib64/python2.7/lib-dynload',
'/usr/lib64/python2.7/site-packages',
'/usr/lib64/python2.7/site-packages/gtk-2.0',
'/usr/lib/python2.7/site-packages',
'/var/www/html/LPAR-reservation-system']

Server time: Tue, 1 Nov 2016 15:14:20 +0800

Outdated dependencies

  • Incompatible with Django 1.5
  • Uses a deprecated versionn of django-registration (does not work with >= v1.0)

Would these be resolved?

MultipleObjectsReturned, get() returned more than one Online

Hi,

I was testing the forum from multiple devices (2 laptops and my phone), when suddenly it returned this:

MultipleObjectsReturned at /
get() returned more than one Online -- it returned 2! Lookup parameters were {'ident': '190.215.132.123'}

This may be a problem with online user, but I'm not sure.

The exception was thrown at line 11 of the onlineuser/middleware.py file

        o, created = Online.objects.get_or_create(ident=ip)

staticfiles

You should include
"django.core.context_processors.static",

in TEMPLATE_CONTEXT_PROCESSORS in the readme, it seems to be required for the templates to work properly.

Great project BTW

PYPI version cannot be installed

There is an error while installing with pip

Collecting lbforum
  Using cached LBForum-2.0.0.tar.gz
Collecting Django==1.10 (from lbforum)
  Using cached Django-1.10-py2.py3-none-any.whl
Collecting django-el-pagination==3.0.1 (from lbforum)
  Using cached django-el-pagination-3.0.1.tar.gz
Collecting easy_thumbnails==2.3 (from lbforum)
  Using cached easy_thumbnails-2.3-py2.py3-none-any.whl
Collecting beautifulsoup4==4.5.1 (from lbforum)
  Using cached beautifulsoup4-4.5.1-py3-none-any.whl
Collecting BeautifulSoup==3.2.1 (from lbforum)
  Using cached BeautifulSoup-3.2.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-hygkh21d/BeautifulSoup/setup.py", line 22
        print "Unit tests have failed!"
                                      ^
    SyntaxError: Missing parentheses in call to 'print'

I believe it is due to the two beautifulsoups from the setup.py file of the PYPI version.

install_requires = [
    'Django==1.10',
    'django-el-pagination==3.0.1',
    'easy_thumbnails==2.3',
    'beautifulsoup4==4.5.1',
    'BeautifulSoup==3.2.1',
    'python-dateutil==2.5.3',
    'django-constance==1.2',
    'django_picklefield==0.3.2',
    'django-lbattachment==1.0.2',
    'django-lbutils==1.0.1',
    'djangorestframework==3.4.6',
]

TypeError: can't subtract offset-naive and offset-aware datetimes

Django 1.4.2,python2.6,RHEL 6环境下,发现论坛用户显示一直为离线。调试发现:

Python 2.6.6 (r266:84292, Jan 5 2012, 16:06:56)
[GCC 4.4.5 20110214 (Red Hat 4.4.5-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)

from django.contrib.auth.models import User
try_user = User.objects.get(username = 'test')
try_user
<User: test>
try_user.online.online()
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.6/site-packages/onlineuser/models.py", line 42, in online
if (now - self.updated_on).seconds < last_online_duration:
TypeError: can't subtract offset-naive and offset-aware datetimes

问题出在 onlineuser/models.py 中:

def online(self):
now = datetime.now()
if (now - self.updated_on).seconds < last_online_duration:
return True
return False

分析之后是一个不带时区减一个带时区的时间,报错,所以我修改如下

...
import pytz
TIME_ZONE = getattr(settings, 'TIME_ZONE', "Asia/Shanghai")
...

def online(self):
    tz=pytz.timezone(TIME_ZONE)
    now = datetime.now(tz)
    if (now - self.updated_on).seconds < last_online_duration:
        return True
    return False 

问题解决。

尚不清楚在其他环境中是否正确。

Not compatible with Django 1.5

LBForum relies on functions that are no longer present in the current Django version 1.5 and onwards.

For example, django.views.generic.simple is used in urls.py but class-based generic views got rewritten in Django 1.3.

No module named djangobower

When I run commond manage.py bower install in cmd, it shows ImportError: No module named djangobower. But I have added 'djangobower', in INSTALLED_APPS in settings.py

The full error report is

Traceback (most recent call last):
File "manage.py", line 22, in
execute_from_command_line(sys.argv)
File "C:\Users\zwr\Desktop\venv_Django\lib\site-packages\django\core\management_init_.py", line 367, in execute_from_command_line
utility.execute()
File "C:\Users\zwr\Desktop\venv_Django\lib\site-packages\django\core\management_init_.py", line 341, in execute
django.setup()
File "C:\Users\zwr\Desktop\venv_Django\lib\site-packages\django_init_.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\zwr\Desktop\venv_Django\lib\site-packages\django\apps\registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "C:\Users\zwr\Desktop\venv_Django\lib\site-packages\django\apps\config.py", line 90, in create
module = import_module(entry)
File "D:\python27\lib\importlib_init_.py", line 37, in import_module
import(name)
ImportError: No module named djangobower

pip里面不考虑更新了吗?

$ pip -v search lbforum 
Starting new HTTPS connection (1): pypi.python.org
"POST /pypi HTTP/1.1" 200 None
LBForum (0.9.22)  - LBForum is a quick and simple forum which uses the Django Framework.
  INSTALLED: 0.9.22 (latest)

I have run it well and then i share my cfg here

npm install bower

  • npm version 5.5.1
  • npm install -g bower npm install -g bower

settings.py

from .base_settings import *

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'forum',
        'USER': 'admin105',
        'PASSWORD': 'yesadmin@816',
        'HOST': '192.168.2.110',
        'PORT': '5432',
    }
}


INSTALLED_APPS += [
    'el_pagination',
    'easy_thumbnails',
    'constance',
    'constance.backends.database',
    'djangobower',

    'lbforum',
    'lbattachment',
    'lbutils',
]

TEMPLATES[0]['OPTIONS']['context_processors'] += ['django.contrib.messages.context_processors.messages', ]

PRJ_ROOT = BASE_DIR

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(PRJ_ROOT, 'collectedstatic')

HOST_URL = ''
MEDIA_URL_ = '/media/'
MEDIA_URL = HOST_URL + MEDIA_URL_
MEDIA_ROOT = os.path.join(PRJ_ROOT, 'media')

SIGNUP_URL = '/accounts/signup/'
LOGIN_URL = '/accounts/login/'
LOGOUT_URL = '/accounts/logout/'
LOGIN_REDIRECT_URL = '/'
CHANGE_PASSWORD_URL = '/accounts/password/change/'

CONSTANCE_BACKEND = 'constance.backends.database.DatabaseBackend'

CONSTANCE_CONFIG = {
    'forbidden_words': ('', 'Forbidden words', str),
}

## setting for BOWER
from django.conf.global_settings import STATICFILES_FINDERS
STATICFILES_FINDERS += (('djangobower.finders.BowerFinder'),)

BOWER_COMPONENTS_ROOT = PRJ_ROOT

BOWER_INSTALLED_APPS = (
    'jquery#1.12',
    'markitup#1.1.14',
    'mediaelement#2.22.0',
    'blueimp-file-upload#9.12.5',
)

## 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']
"""

requirements.txt

--index-url https://pypi.tuna.tsinghua.edu.cn/simple

django==1.10
django-bower
lbforum
postmarkup==1.2.2
# PyMySQL==0.9.2 
psycopg2==2.7.5

[project_name]/urls.py

from django.conf.urls import url, include
from django.contrib import admin

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^', include('lbforum.urls')),
    url(r'^attachments/', include('lbattachment.urls')),
]

PIL

Could not find a version that satisfies the requirement PIL (from lbforum) (from versions: )
No matching distribution found for PIL (from lbforum)

pip install error

It would be good to use Pillow instead of PIL then the dependencies can be solved easily by pip.

pip install lbforum
Collecting lbforum
Using cached LBForum-0.9.22.zip
Collecting Django>=1.3 (from lbforum)
Using cached Django-1.10-py2.py3-none-any.whl
Collecting django-helper>=0.8.1 (from lbforum)
Using cached django-helper-0.8.4.tar.gz
Collecting django-lb-attachments>=0.8 (from lbforum)
Using cached django-lb-attachments-0.8.3.tar.gz
Collecting django-onlineuser>=0.8 (from lbforum)
Using cached django-onlineuser-0.8.7.zip
Collecting django-simple-avatar>=0.8.1 (from lbforum)
Using cached django-simple-avatar-0.8.6.zip
Collecting BeautifulSoup (from lbforum)
Using cached BeautifulSoup-3.2.1.tar.gz
Collecting postmarkup (from lbforum)
Using cached postmarkup-1.2.2.tar.gz
Collecting django-pagination (from lbforum)
Using cached django-pagination-1.0.7.tar.gz
Collecting PIL (from lbforum)
Could not find a version that satisfies the requirement PIL (from lbforum) (from versions: )
No matching distribution found for PIL (from lbforum)

首页访问报错

Environment:

Request Method: GET
Request URL: http://127.0.0.1:8000/

Django Version: 1.10
Python Version: 3.5.2
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'el_pagination',
'easy_thumbnails',
'constance',
'constance.backends.database',
'djangobower',
'lbforum',
'lbattachment',
'lbutils']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'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',
'django.contrib.messages.context_processors.messages']

Traceback:

File "/home/dev/virtualenv/py3env/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
39. response = get_response(request)

Exception Type: TypeError at /
Exception Value: 'dict' object is not callable

请问是我配置的问题么,另外我安装过程中发现配置里面PRJ_URL未定义

Fix simple typo: edtor -> editor

Issue Type

[x] Bug (Typo)

Steps to Replicate

  1. Examine README.rst.
  2. Search for edtor.

Expected Behaviour

  1. Should read editor.

Semi-automated issue generated by
https://github.com/timgates42/meticulous/blob/master/docs/NOTE.md

To avoid wasting CI processing resources a branch with the fix has been
prepared but a pull request has not yet been created. A pull request fixing
the issue can be prepared from the link below, feel free to create it or
request @timgates42 create the PR. Alternatively if the fix is undesired please
close the issue with a small comment about the reasoning.

https://github.com/timgates42/LBForum/pull/new/bugfix_typo_editor

Thanks.

django.core.context_processors.static in Django-1.4

Hello!

By default Djang-1.4 does not include django.core.context_processors.static in TEMPLATE_CONTEXT_PROCESSORS, about this {{ STATIC_URL }} is emty in templates.

Please add

"django.core.context_processors.static",

line to list TEMPLATE_CONTEXT_PROCESSORS in readme file.

Thank you.

P.S.
Sorry for my ugly English.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.