Code Monkey home page Code Monkey logo

drum's Introduction

image

Drum

Created by Stephen McDonald

Drum is a Reddit / Hacker News clone, built using Mezzanine and Django. It is BSD licensed, and designed to demonstrate some of the non-CMS capabilities of Mezzanine, such as threaded comments, ratings, and public user accounts.

Check out the blog post Building Social Apps with Mezzanine, which contains a detailed walk-through of how Drum was built. A live demo of Drum is also available.

Dependencies

Drum is designed as a plugin for the Mezzanine content management platform, and therefore requires Mezzanine to be installed. The integration of the two applications should occur automatically by following the installation instructions below.

Installation

The easiest method is to install directly from PyPI using pip by running the command below, which will also install the required dependencies mentioned above:

$ pip install -U drum

Otherwise, you can download Drum and install it directly from source:

$ python setup.py install

Once installed, the command mezzanine-project can be used to create a new Mezzanine project, with Drum installed, in similar fashion to django-admin.py:

# FIXME: add new instructions of how to create a project with drum
$ mezzanine-project -a drum project_name
$ cd project_name
$ python manage.py createdb --noinput
$ python manage.py runserver

Here we specify the -a switch for the mezzanine-project command, which tells it to use an alternative package (drum) for the project template to use. Both Mezzanine and Drum contain a project template package containing the settings.py and urls.py modules for an initial project. If you'd like to add Drum to an existing Mezzanine or Django project, you'll need to manually configure these yourself. See the FAQ section of the Mezzanine documentation for more information.

Note

The createdb is a shortcut for using Django's syncdb command and setting the initial migration state. You can alternatively use syncdb and migrate if preferred.

You should then be able to browse to http://127.0.0.1:8000/admin/ and log in using the default account (username: admin, password: default). If you'd like to specify a different username and password during set up, simply exclude the --noinput option included above when running createdb.

RSS Import

One difficulty faced with a Drum site is building up an initial user base, as well as a good amount of interesting link content. This is a bit of a chicken and egg problem, in that each of these depends on the other. One way to address this is to automatically populate the site with interesting links. To help with this, Drum provides the Django management command poll_rss for retrieving links from an RSS feed, and populating the site with them. For example, suppose I was a terrible person and wanted to populate my Drum site with links directly from the Hacker News front page and the programming section of Reddit:

python manage.py poll_rss https://news.ycombinator.com/rss http://www.reddit.com/r/programming/.rss

Here you can see multiple RSS feeds being passed to the command, which I could then run on a scheduled basis using a cron job. Note that to use the poll_rss command, you'll need the feedparser library installed.

Auto Tagging

Drum provides some basic support for automatically tagging new links as they're added. This is first configured by setting the AUTO_TAG setting to True. With that set, when a new link is added, its given title is broken up into keywords, and if those keywords already exist as tags in the database, they're applied to the newly added link.

This means that for auto-tagging to work, the tags must already exist in the database. You can either add them manually via the admin (under the "Keywords" section), or if you have a large number of existing links, you can use the auto_tag management command Drum provides, which will analyse the titles of all your existing links, and provide tags it extracts from them. This makes use of the topia.termextract package which you'll first need to install:

python manage.py auto_tag --generate=100 --assign --remove

The --generate option must be provided to extract tags, and limits the number of tags extracted. Generally more tags will be extracted than are relevant, depending on your existing set of links, so experiment with different values here. You'll likely want to review all the tags added, deleting some and manually editing others, via the Django admin interface. The --assign option will go back and assign all tags in the database to all links in the database, as would occur if they were newly created. The --remove option will cause all existing tags to be removed.

You can also define your own tag extraction function, if splitting the title on spaces doesn't suffice. To do so, define the setting AUTO_TAG_FUNCTION which should contain a string with the Python dotted path to your custom tag function. The function will be given an unsaved Link object, and should return a sequence of tags to add.

Contributing

Drum is an open source project managed using both the Git and Mercurial version control systems. These repositories are hosted on both GitHub and Bitbucket respectively, so contributing is as easy as forking the project on either of these sites and committing back your enhancements.

Please note the following guidelines for contributing:

  • Contributed code must be written in the existing style. This is as simple as following the Django coding style and (most importantly) PEP 8.
  • Contributions must be available on a separately named branch based on the latest version of the main branch.
  • Run the tests before committing your changes. If your changes cause the tests to break, they won't be accepted.
  • If you are adding new functionality, you must include basic tests and documentation.

Donating

If you would like to make a donation to continue development of Drum, you can do so via the Mezzanine Project website.

Support

To report a security issue, please send an email privately to [email protected]. This gives us a chance to fix the issue and create an official release prior to the issue being made public.

For general questions or comments, please join the mezzanine-users mailing list. To report a bug or other type of issue, please use the GitHub issue tracker. And feel free to drop by the #mezzanine IRC channel on Freenode, for a chat.

Sites Using Drum

drum's People

Contributors

abendig avatar aobyrne avatar jnkwrych avatar kvser avatar rafen avatar stephenmcd avatar tebica avatar w194 avatar yasoob avatar yodermk 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

drum's Issues

See users who upvoted a certain link

I would like to be able to view which users specifically upvoted a certain link. May I know how you would go about implementing this? Thank you.

How are comments displayed? Controlling display of comments.

If a lot of users post a lot of threaded comments how are they displayed?
Are all comments displayed without hiding or folding?

If I want to use algorithms for hiding or folding comments would I programatticaly have control over them.

Is there a way to add additional attributes to comments?

Would I have to create a the CommentsField() column code in mezzanine?

Is there an easy way to do it?

Auto tags issue

The README said:

This means that for auto-tagging to work, the tags must already exist in the database. You can either add them manually via the admin...

But I can't find the way to add existed tags in the admin panel. Could you help me?

Following setup instructions, demo site not working.

Well, I do not know if it makes sense to paste all the error messages, however it results in a

A server error occurred.  Please contact the administrator.

when visiting 127.0.0.1/admin or 127.0.0.1

the console output has this last line:

RuntimeError: Model class mezzanine.pages.models.Page doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

Also there are some warnings before that:

System check identified some issues:

WARNINGS:
?: (mezzanine.core.W01) Please update your settings to use the TEMPLATES setting rather than the deprecated individual TEMPLATE_ settings. The latter are unsupported and correct behaviour is not guaranteed. Here's a suggestion based on on your existing configuration:

TEMPLATES = [{u'APP_DIRS': True,
              u'BACKEND': u'django.template.backends.django.DjangoTemplates',
              u'DIRS': (u'/home/xxx/tmp/test/mezzanine-drum/drumtest/templates',),
              u'OPTIONS': {u'builtins': [u'mezzanine.template.loader_tags'],
                           u'context_processors': (u'django.contrib.auth.context_processors.auth',
                                                   u'django.contrib.messages.context_processors.messages',
                                                   u'django.core.context_processors.debug',
                                                   u'django.core.context_processors.i18n',
                                                   u'django.core.context_processors.static',
                                                   u'django.core.context_processors.media',
                                                   u'django.core.context_processors.request',
                                                   u'django.core.context_processors.tz',
                                                   u'mezzanine.conf.context_processors.settings',
                                                   u'mezzanine.pages.context_processors.page')}}]

?: (mezzanine.core.W02) TEMPLATE_DEBUG and DEBUG settings have different values, which may not be what you want. Mezzanine used to fix this for you, but doesn't any more. Update your settings.py to use the TEMPLATES setting to have template debugging controlled by the DEBUG setting.

System check identified 2 issues (0 silenced).

Is there a quick fix for this? I just wanted to take a look at mezzanine...

Error on createdb: mezzanine.accounts.ProfileNotConfigured

Using the master branch from this repo with python setup.py install the createdb command gives me this error:

mezzanine.accounts.ProfileNotConfigured

What do I have to do to just get this running so I can test mezzanine?

Thanks again for your attention.

Make profile model configurable?

On a project I am working on, there is already a user profile that captures non-authentication user information, so the only really interesting new field that drum's Profile model provides is the karma field. We would prefer just using the one class. I'm considering adding a setting to drum, such that you can specify which Profile model it should use. The default would be the current one, but if specified otherwise, it could just access a different one.

Does that seem reasonable and if so, would you want that in the code?

about urlconf in settings.py

https://github.com/stephenmcd/drum/blob/master/settings.py#L10

ROOT_URLCONF = "%s.urls" % PROJECT_DIRNAME

this is not working in some situations (like on OpenShift), Drum moved settings.py, urls.py outside main for keeping apps separated, so basically, PROJECT_DIRNAME won't be in python path, but when I try it locally, it works.

but when I get it on OpenShift, it failed and keep reporting me

ImportError: No module named repo.urls

I suspect that the reason is OpenShift put wsgi in a strange way, e.g. project/wsgi/application, but not a single wsgi.py file

But I'm also curious how this work under Drum project structure, does anyone know that?

Thank you.

Bug: Karma score/AJAX voting bug

How to produce: By continuously clicking on either "Up arrow" or "Down arrow", you will notice that the karma points for the OP increase or decrease as the user clicks.

Expected: It is only expected for the karma point to be incremented or decremented once per user.

Note: It will only affect the karma points of others. Not the current logged in user's own post.

Refresh in LinkDetail

I'm using drum to build a website and made some additions to the link_detail template, in particular added a javascript chart. The issue is that the chart is not showing when I click from the home to the respective linkdetail, only when I refresh it. Any idea why this is happening?

Problems starting a mezzanine project with Drum installed

Hi, I'm having some problems launching a drum project

When I use this command
mezzanine-project -a drum project_name

I get this error, regardless of the project_name used:
CommandError: 'project_name' conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name.

Any thoughts?

Thanks

Tests

The docs mention tests. Are there any? If not, do you have any preferred testing framework?

Karma does not update when rating is reset to 0

To reproduce:
Log in to an account.
Find a link submitted by a user other than this account.
Click the Upvote arrow several times.

Result:
Karma of the submitting user increments each time the rating is +1, does not decrement when clicking the arrow resets the link rating, meaning a single user can use a single link to control another user's karma.

Expected Result:
Karma decrements (or increments if using the down arrow) when an arrow click resets the user's rating of a link to 0.

ImportError: cannot import name 'patterns' with Django 1.10

Clean install of drum and mezzanine gives the following error, as Django 1.10 has removed patterns:

(testDrum) erics-mbp:website eric$ python manage.py createdb /Users/eric/virtualenv/testDrum/lib/python3.4/site-packages/mezzanine/utils/conf.py:56: UserWarning: You haven't defined the ALLOWED_HOSTS settings, which Django requires. Will fall back to the domains configured as sites. warn("You haven't defined the ALLOWED_HOSTS settings, which " /Users/eric/virtualenv/testDrum/lib/python3.4/site-packages/mezzanine/accounts/defaults.py:23: UserWarning: Django's AUTH_PROFILE_MODULE setting is deprecated, use Mezzanine's ACCOUNTS_PROFILE_MODEL instead. warn("Django's AUTH_PROFILE_MODULE setting is deprecated, use " Traceback (most recent call last): File "manage.py", line 14, in <module> execute_from_command_line(sys.argv) File "/Users/eric/virtualenv/testDrum/lib/python3.4/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line utility.execute() File "/Users/eric/virtualenv/testDrum/lib/python3.4/site-packages/django/core/management/__init__.py", line 359, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Users/eric/virtualenv/testDrum/lib/python3.4/site-packages/django/core/management/base.py", line 305, in run_from_argv self.execute(*args, **cmd_options) File "/Users/eric/virtualenv/testDrum/lib/python3.4/site-packages/django/core/management/base.py", line 353, in execute self.check() File "/Users/eric/virtualenv/testDrum/lib/python3.4/site-packages/django/core/management/base.py", line 385, in check include_deployment_checks=include_deployment_checks, File "/Users/eric/virtualenv/testDrum/lib/python3.4/site-packages/django/core/management/base.py", line 372, in _run_checks return checks.run_checks(**kwargs) File "/Users/eric/virtualenv/testDrum/lib/python3.4/site-packages/django/core/checks/registry.py", line 81, in run_checks new_errors = check(app_configs=app_configs) File "/Users/eric/virtualenv/testDrum/lib/python3.4/site-packages/django/core/checks/urls.py", line 14, in check_url_config return check_resolver(resolver) File "/Users/eric/virtualenv/testDrum/lib/python3.4/site-packages/django/core/checks/urls.py", line 24, in check_resolver for pattern in resolver.url_patterns: File "/Users/eric/virtualenv/testDrum/lib/python3.4/site-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/Users/eric/virtualenv/testDrum/lib/python3.4/site-packages/django/urls/resolvers.py", line 310, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/Users/eric/virtualenv/testDrum/lib/python3.4/site-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/Users/eric/virtualenv/testDrum/lib/python3.4/site-packages/django/urls/resolvers.py", line 303, in urlconf_module return import_module(self.urlconf_name) File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/__init__.py", line 109, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 2254, in _gcd_import File "<frozen importlib._bootstrap>", line 2237, in _find_and_load File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked File "<frozen importlib._bootstrap>", line 1129, in _exec File "<frozen importlib._bootstrap>", line 1471, in exec_module File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed File "/Users/eric/virtualenv/testDrum/website/website/urls.py", line 2, in <module> from django.conf.urls import patterns, include, url ImportError: cannot import name 'patterns'

Add build/test status

It would be nice to have a build/test status indicator in the readme to see if all is well. Travis CI is good for that sort of stuff. What do you think?

ProfileNotConfigured Error

commit 880a112 causes this issue. rollback to parent d863e39 and it works fine.

I try to trace the problem, and find in mezzanine/accounts/__init__.py, get_profile_model() doesn't get the current settings.

how can I close user auth options

I would like to change the project in a way that no user auth is necessary and I only like to show some list of links to users. They are only able to vote up but it does not require sign up. Could you give me a little description what components need to be changed for these alternations?

manage.py poll_rss fails.

sigh... next step in README, next error...

ValueError: <Rating: Rating object> instance isn't saved. Use bulk=False or save the object first.

do not work with django 1.9.*

Hi,

drum work on django version <= 1.8.12
`Performing system checks...

/home/keiser1080/.virtualenvs/pypy-env/site-packages/django/template/utils.py:37: RemovedInDjango110Warning: You haven't defined a TEMPLATES setting. You must do so before upgrading to Django 1.10. Otherwise Django will be unable to load templates.
"unable to load templates.", RemovedInDjango110Warning)

System check identified some issues:

WARNINGS:
?: (mezzanine.core.W01) Please update your settings to use the TEMPLATES setting rather than the deprecated individual TEMPLATE_ settings. The latter are unsupported and correct behaviour is not guaranteed. Here's a suggestion based on on your existing configuration:

TEMPLATES = [{u'APP_DIRS': True,
u'BACKEND': u'django.template.backends.django.DjangoTemplates',
u'DIRS': (u'/home/keiser1080/dev/drumbase/templates',),
u'OPTIONS': {u'builtins': [u'mezzanine.template.loader_tags'],
u'context_processors': (u'django.contrib.auth.context_processors.auth',
u'django.contrib.messages.context_processors.messages',
u'django.core.context_processors.debug',
u'django.core.context_processors.i18n',
u'django.core.context_processors.static',
u'django.core.context_processors.media',
u'django.core.context_processors.request',
u'django.core.context_processors.tz',
u'mezzanine.conf.context_processors.settings',
u'mezzanine.pages.context_processors.page')}}]

?: (mezzanine.core.W02) TEMPLATE_DEBUG and DEBUG settings have different values, which may not be what you want. Mezzanine used to fix this for you, but doesn't any more. Update your settings.py to use the TEMPLATES setting to have template debugging controlled by the DEBUG setting.

System check identified 2 issues (0 silenced).
April 17, 2016 - 18:47:16
Django version 1.9.5, using settings 'drumbase.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
Traceback (most recent call last):
File "/home/keiser1080/pypy-5.0.1-linux-armhf-raspbian/lib-python/2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/home/keiser1080/.virtualenvs/pypy-env/site-packages/django/contrib/staticfiles/handlers.py", line 63, in call
return self.application(environ, start_response)
File "/home/keiser1080/.virtualenvs/pypy-env/site-packages/django/contrib/staticfiles/handlers.py", line 63, in call
return self.application(environ, start_response)
File "/home/keiser1080/.virtualenvs/pypy-env/site-packages/django/core/handlers/wsgi.py", line 158, in call
self.load_middleware()
File "/home/keiser1080/.virtualenvs/pypy-env/site-packages/django/core/handlers/base.py", line 51, in load_middleware
mw_class = import_string(middleware_path)
File "/home/keiser1080/.virtualenvs/pypy-env/site-packages/django/utils/module_loading.py", line 20, in import_string
module = import_module(module_path)
File "/home/keiser1080/pypy-5.0.1-linux-armhf-raspbian/lib-python/2.7/importlib/init.py", line 37, in import_module
import(name)
File "/home/keiser1080/.virtualenvs/pypy-env/site-packages/mezzanine/pages/middleware.py", line 8, in
from mezzanine.pages import context_processors, page_processors
File "/home/keiser1080/.virtualenvs/pypy-env/site-packages/mezzanine/pages/context_processors.py", line 2, in
from mezzanine.pages.models import Page
File "/home/keiser1080/.virtualenvs/pypy-env/site-packages/mezzanine/pages/models.py", line 35, in
class Page(BasePage):
File "/home/keiser1080/.virtualenvs/pypy-env/site-packages/mezzanine/core/models.py", line 390, in new
return super(OrderableBase, cls).new(cls, name, bases, attrs)
File "/home/keiser1080/.virtualenvs/pypy-env/site-packages/django/db/models/base.py", line 102, in new
"INSTALLED_APPS." % (module, name)
RuntimeError: Model class mezzanine.pages.models.Page doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
`

Unknown command: 'createdb'

I am following the installation manual from github,
After running ./manage.py createdb --noinput I face the following error,

Unknown command: 'createdb' Type 'manage.py help' for usage.

when I run directly, python manage.py syncdb
I get, raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.

any hint? thanks,

Auto tags with more than 1 word

Is it possible to have with auto_tag = True,
keywords compounds not only one word tagged ?
If so how could I proceed?

Thx

Graphical issue with pages

Out of the box, drum has 20 links configured to be placed on the homepage and all further posts are divided into a second page of 20 links and so forth. Once you submit over 20 links, I've found the graphical navigation at the bottom (to navigate between pages) get out of place. I'm not sure if this happens on all installs but I would assume it does, as I haven't made many modifications. This is what it looks like; I am assuming this is not intended:

"Page 1 of 2
โ†
1
2
โ†’"

Links for live demo and food news are down.

Please remove the live demo and food news and add working examples so I can see it work. If people want to use it they may be put off by the sites not being available. You could get more exposure and code contributions if people are confident in the software.

Search doesn't work by default. Customization.

Search doesn't work by default - it's trying to search in Mezzanine's default: ('pages.Page', 'blog.BlogPost') models that Drum doesn't use (at least by default).
"SEARCH_MODEL_CHOICES = ('drum.links.Link')" in the default settings.py or "{% search_form "drum.links.Link" %}" in the base template would be great :)

Also, what is the best way to customize Drum? Now I only found a solution to copy 'drum.links' app to project's dir as a new app and adjust everything to it (settings.py, urls.py, new_app_name.urls.py). Maybe it is / will be possible to override the default Drum by creating a new "app-theme" in the project's dir with particular files that you customizing like you do it now with Mezzanine?

CSS?

Where are the editable CSS files for Drum? I have it up and running but when I change files in drum/links/static/css there are no visible changes on the local site...confused

Error Python 3 when install library "topia.termextract" for auto_tag

Hi,
I installed for a project Drum and installing as the documentation mentions the library to auto_tag topia.termextract , I get the following error when I use this command

python manage.py auto_tag --generate=100 --assign --remove

ERROR:
TypeError: Class advice impossible in Python3. Use the @Implementer class decorator instead.

Thank you !

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.