Skip to content

Commit

Permalink
update setup
Browse files Browse the repository at this point in the history
  • Loading branch information
vicalloy committed Aug 8, 2016
1 parent 7beeb07 commit 49c92e1
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 125 deletions.
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*.pyc
*.swp
*.sqlite
*.pyc
*.swp
*.sqlite
*.egg-info/
build/
4 changes: 0 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
BSD License
http://creativecommons.org/licenses/BSD/

FluxBB Skin is base on FluxBB(by Paul Sullivan).
GPL
http://www.gnu.org/licenses/old-licenses/gpl-1.0.html
7 changes: 4 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ include README.rst
include LICENSE
include MANIFEST.in
include requirements.txt
recursive-include lbforum/locale *
recursive-include lbforum/templates *.html
recursive-include lbforum/templates_v2ex *.html
recursive-include lbforum/static *
recursive-include lbforum/fixtures *.json
recursive-include lbforum/templates *.html *.txt
recursive-include lbforum/locale *.po *.mo
recursive-include docs *
148 changes: 57 additions & 91 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ LBForum

.. |rst| replace:: :emphasis:`re`\ :strong:`Structured`\ :sup:`Text`

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
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.
LBForum is distributed under the BSD.

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

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

Expand All @@ -23,37 +22,19 @@ Features
* 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)
* avatar support
* BBCode support
* friendly edtor(by markItUp!).
* Sticky threads (These threads are always sorted first in the list of threads)

Requirements
============

* `Python 2.5+`_
* `Django 1.3+`_
* PIL_
* django-pagination_
* `south 0.7.2+`_
* postmarkup_
* BeautifulSoup_
* django-helper_
* django-lb-attachments_
* django-onlineuser_
* django-simple-avatar_

.. _`Python 2.5+`: http://python.org/
.. _`Django 1.3+`: http://www.djangoproject.com/
.. _PIL: http://www.pythonware.com/products/pil/
.. _django-pagination: http://code.google.com/p/django-pagination/
.. _`south 0.7.2+`: http://south.aeracode.org/
.. _BeautifulSoup: http://www.crummy.com/software/BeautifulSoup/
.. _postmarkup: http://code.google.com/p/postmarkup/
.. _django-helper: https://github.com/vicalloy/django-helper
.. _django-lb-attachments: https://github.com/vicalloy/django-lb-attachments
.. _django-onlineuser: https://github.com/vicalloy/onlineuser
.. _django-simple-avatar: https://github.com/vicalloy/django-simple-avatar
* `Python 2.7`_
* `Django 1.10`_

.. _`Python 2.7`: http://python.org/
.. _`Django 1.10`: http://www.djangoproject.com/

Installation
============
Expand All @@ -76,68 +57,66 @@ Configuration

Config urls.py::

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


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

#. Add the following app to ``INSTALLED_APPS``::

'pagination',
'south',
'el_pagination',
'easy_thumbnails',
'constance',
'constance.backends.database',
'djangobower',

'lbforum',
'simpleavatar',
'djangohelper',
'onlineuser',
'attachments',
'lbattachment',
'lbutils',

#. Add the following middleware to ``MIDDLEWARE_CLASSES``::
#. Add the following middleware to ``TEMPLATES['OPTIONS']['context_processors']``::

'pagination.middleware.PaginationMiddleware',
'onlineuser.middleware.OnlineUserMiddleware',
'django.contrib.messages.context_processors.messages',
#. 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",
)

#. 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/".
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')
#The URL where requests are redirected after login
SIGNUP_URL = '/accounts/signup/'
LOGIN_URL = '/accounts/login/'
LOGOUT_URL = '/accounts/logout/'
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
#. vars for templates::
CHANGE_PASSWORD_URL = '/accounts/password/change/'

#. settings for constance::

CTX_CONFIG = {
'LBFORUM_TITLE': 'LBForum',
'LBFORUM_SUB_TITLE': 'A forum engine written in Python using Django',
'FORUM_PAGE_SIZE': 50,
'TOPIC_PAGE_SIZE': 20,
CONSTANCE_BACKEND = 'constance.backends.database.DatabaseBackend'

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

#. 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',
)
'LOGIN_URL': LOGIN_URL,
'LOGOUT_URL': LOGOUT_URL,
'REGISTER_URL': REGISTER_URL,
}
#. settings for BBCODE::

BBCODE_AUTO_URLS = True
Expand Down Expand Up @@ -170,22 +149,9 @@ The LBForum has some settings should be set in `settings.py`:
'usemap', 'valign', 'value', 'vspace', 'width', 'style']
"""
#. 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,
)
Initialize The Database
Initialize The Database & Static Files
-----------------------

#. Run command ``manage.py bower install``

#. Run command ``manage.py migrate``
33 changes: 9 additions & 24 deletions lbforum/fixtures/test_lbforum.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
"pk": 1,
"model": "lbforum.category",
"fields": {
"ordering": 1,
"oid": 1,
"updated_on": null,
"created_on": "2012-10-30T04:44:26.852",
"name": "category",
"description": "category"
"descn": "category"
}
},
{
Expand All @@ -52,12 +52,11 @@
"fields": {
"category": 1,
"description": "a test forum",
"ordering": 1,
"oid": 1,
"created_on": "2012-10-30T04:44:51.666",
"num_posts": 4,
"updated_on": null,
"num_topics": 2,
"last_post": "gAJ9cQAoVQlwb3N0ZWRfYnlxAVgIAAAAdmljYWxsb3lxAlUGdXBkYXRlcQNjZGF0ZXRpbWUKZGF0ZXRpbWUKcQRVCgfcCh4UEywAnpdxBYVxBlJxB3Uu",
"slug": "forum",
"name": "forum"
}
Expand Down Expand Up @@ -91,7 +90,6 @@
"updated_on": null,
"post": 1,
"sticky": false,
"last_post": "gAJ9cQAoVQlwb3N0ZWRfYnlxAVgIAAAAdmljYWxsb3lxAlUGdXBkYXRlcQNjZGF0ZXRpbWUKZGF0ZXRpbWUKcQRVCgfcCh4UEywAnpdxBYVxBlJxB3Uu",
"posted_by": 2,
"last_reply_on": "2012-10-30T20:19:44.040",
"subject": "topic"
Expand All @@ -116,7 +114,6 @@
"updated_on": null,
"post": 2,
"sticky": false,
"last_post": "gAJ9cQAoVQlwb3N0ZWRfYnlxAVgFAAAAYWRtaW5xAlUGdXBkYXRlcQNjZGF0ZXRpbWUKZGF0ZXRpbWUKcQRVCgfcCh4UEi8OwB1xBYVxBlJxB3Uu",
"posted_by": 1,
"last_reply_on": "2012-10-30T20:18:47.966",
"subject": "topic"
Expand All @@ -136,8 +133,7 @@
"topic_post": false,
"updated_on": null,
"has_attachments": false,
"message": "user reply",
"edited_by": ""
"message": "user reply"
}
},
{
Expand All @@ -154,8 +150,7 @@
"topic_post": false,
"updated_on": null,
"has_attachments": false,
"message": "reply",
"edited_by": ""
"message": "reply"
}
},
{
Expand All @@ -172,8 +167,7 @@
"topic_post": true,
"updated_on": null,
"has_attachments": false,
"message": "test topic",
"edited_by": ""
"message": "test topic"
}
},
{
Expand All @@ -190,30 +184,21 @@
"topic_post": true,
"updated_on": null,
"has_attachments": false,
"message": "topic content.",
"edited_by": ""
"message": "topic content."
}
},
{
"pk": 1,
"model": "lbforum.lbforumuserprofile",
"fields": {
"last_activity": "2012-10-30T20:19:06.046",
"userrank": "Junior Member",
"signature": "",
"user": 1,
"last_posttime": "2012-10-30T20:18:47.966"
"user": 1
}
},
{
"pk": 2,
"model": "lbforum.lbforumuserprofile",
"fields": {
"last_activity": "2012-10-30T20:19:56.574",
"userrank": "Junior Member",
"signature": "",
"user": 2,
"last_posttime": "2012-10-30T20:19:44.040"
"user": 2
}
}
]
5 changes: 5 additions & 0 deletions lbforum/templates/lbforum/topic.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
{% include 'lbforum/widgets/cur_user_profile.html' %}
{% endblock %}

{% block extra_header %}
{{ block.super }}
<link rel="stylesheet" type="text/css" media="screen" href="{% static 'lbforum/styles/pygments.css' %}"/>
{% endblock %}

{% block content_content %}
{% paginate posts %}
{% get_pages %}
Expand Down

0 comments on commit 49c92e1

Please sign in to comment.