A project for HSE programming technologies course. See wiki.cs.hse.ru for more information.
Clone the repo and create a virtualenv, if you need one.
Install the requirements:
$ pip install -r requirements.txt
Setup dev mode. You can run in either the DEV=1
mode, TRAVIS=1
mode, or HEROKU=1
mode.
The first one is for development, the second one is fot ci tests, and the third one is for running in production.
$ export DEV=1
Setup other environment variables:
Variable | Description |
---|---|
SECRET_KEY | Used to encrypt session coockies. |
RECAPTCHA_PUBLIC_KEY | Public key for ReCaptcha. |
RECAPTCHA_PPRIVATE_KEY | Private key for ReCaptcha. |
DEFAULT_FROM_EMAIL | Email settings. See the Django documentation. |
EMAIL_HOST | -//- |
EMAIL_HOST_PASSWORD | -//- |
EMAIL_HOST_USER | -//- |
SERVER_EMAIL | -//- |
Migrate your database:
$ cd collective-blog/
$ python manage.py makemigrations
$ python manage.py migrate
By default, SQLite is used. Be aware that SQLite can't perform case insensitive queries so urls and usernames will be case sensitive.
Launch the dev server:
$ python manage.py runserver 0.0.0.0:8000
Or tests (well, they are not ready yed; only markdown rendering is covered properly as it is the only thing that denormalizes the database):
$ python manage.py test
Each user can create a new blog. Once a new blog is created, it can be filled with content.
All blogs can be configured by creator:
- Type of the blog: open (anyone can see everything, news are shown on the main page), or private (only users who joined the blog can see its contents).
- Who can join the blog: anyone, user with karma above a decided value, or only approved users.
- Who can write to the blog: anyone or users with karma above a decided value or members of the blog.
- Who can write comments: anyone or users with karma above a decided value or members of the blog.
A blog's creator can assign administrators of the blog. Permissions are configurable:
- Change another user's permissions.
- Change posts.
- Change comments.
- Ban a member.
- Change blog's settings.
Each user has its rating (karma). Users can vote up and down for any other user raising and dropping his karma respectively. Also, each member has individual blog's rating, one value per each blog. This value only matters inside that particular blog and changes while blog members are voting for comments and posts.
- Python 2.7 || >= 3.4
- Django along with plugins for registration, captcha, markdown, and voting.
- Markdown.
- Codemirror for editing markdown.
And no WYSIWYG! ('cause it's evil!)
User auth— doneMarkdown system— doneVotes system— doneUser profiles— doneBlogs— donePosts— doneComments— done
>= 4
Can register, post, comment— doneComments are displayed flat— doneSQL injection protected— done by django
>= 6
A rating system which allows to vote without refreshing the page— done (ajax voting)WYSIWYG | Markdown— done (markdown)XSS proof— done by djangoRegistration page protecred with CAPTCHA— done (ReCapthca)Comments are displayed with tree— done (django mptt)
>= 8
Manageable user permissions.— doneService is ready to launch.— done
collective_blog
— django projectcollective_blog
— root app; Holds config, root url dispatcher, common css, scripts, and templates. Contains main app logic.user
— auth and user profile stuff, everything behind/u/
; Holds auth logic and user profiles.s_appearance
— styles and form renderer.s_markdown
— standalone reusable app for markdown support.s_voting
— models for voting support.