Skip to main content

Generate recommendations in Django.

Project description

Use pyrecommend in Django projects.

Warning: not yet suitable for production.

django_recommend/ is the actual Django app intended for use in projects.

simplerec/ is a Django project used for testing.


  • Add django_recommend to your INSTALLED_APPS, and run python migrate.

  • Set SESSION_SAVE_EVERY_REQUEST=True in your settings, to ensure anonymous users can be tracked.

  • In your views, call django_recommend.set_score(request, object, score) to start recording user scores. (Currently this is assumed to be implicit feedback.) Note: This will use session keys to store scores for users who aren’t authenticated.

  • In your templates, use {% load django_recommend %} and {{ obj|similar_objects }} to show similar objects to visitors. This filter returns a list, so you may also do, for example:

    {% with similar_products as product|similar_objects %}
        {% if similiar_products %}
            <h2>Other users also liked:</h2>
            {% for product in similar_products %}
                <li><a href="{{ product.get_absolute_url }}">{{ product }}</a></li>
            {% endfor %}
        {% endif %}
    {% endwith %}

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-recommend, version 0.1.dev3
Filename, size File type Python version Upload date Hashes
Filename, size django_recommend-0.1.dev3-py2-none-any.whl (11.4 kB) File type Wheel Python version recommend/dist/django_recommend Upload date Hashes View
Filename, size django-recommend-0.1.dev3.tar.gz (7.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page