/stepic_search

Searching for lessons on Stepic.org

Primary LanguagePython

This project allows to search for lessons by titles on Stepic.

Requirements

Python >=3.4 required.

Elasticsearch == 1.7.1 must be installed.

Let's Start

  1. Install Elasticsearch
  • For macos simple install:
brew install elasticsearch
  1. Install other requirements:
pip install -r requirements.txt
  1. Prepare your db:
python manage.py migrate
  1. Load lessons in local models:
  • From [Stepic] (http://stepic.org) by running command in project root directory:

    python manage.py loadlessons
    

    This command will load all available lessons, or you can bound loading pages count with:

    python manage.py loadlessons -p {pages_count}
    
  • From file:

    python manage.py loadlessons -f {path_to_file}
    

    File should be with JSON content like:

    {
      "lessons": [
        { "id": 1, "title": "A Journey of a Thousand Miles. . ." },
        { "id": 2, "title": "Hidden Messages in the Replication Origin" },
        { "id": 3, "title": "Some Hidden Messages are More Surprising than Others" }
      ]
    }
    
  1. Run elasticsearch
$ bin/elasticsearch
  1. Index lessons with command:
python manage.py createindex
  1. Run server:
python manage.py runserver
  1. Go to your site and try to search! Or if you need to see all lessons, try this link.

If you need to delete lessons from your db, you can use command:

python manage.py clearlessons