No Description

Noah Santacruz 5329437bb2 Merge branch 'master' of https://github.com/Sefaria/Sefaria-Project 8 hours ago
build 46ef5cde15 Hold off on priming starburst cache. too heavy 1 month ago
data 95641a7b36 Merge remote-tracking branch 'origin/test' into synthdict 1 month ago
doc 90bc1b60c6 Move get_index and index cache into Library. Code is running. 3 years ago
locale 1ebceec8ad small sheets copy change 5 months ago
node 6c37d6cc8f fix back button when coming from search page 2 weeks ago
reader df53bfb4bc add all_children() method to DictionaryNode. fix small bug with dict autocomplete 3 weeks ago
scripts 0e9dc2f8d5 Add dictionary word count to English word count 4 weeks ago
sefaria 08507c98e8 dont keep virtualnodes' children in memory. use rid for child_order of dictnodes 1 week ago
sourcesheets 700900193c disallow pipe characters in group names 1 month ago
static 5329437bb2 Merge branch 'master' of https://github.com/Sefaria/Sefaria-Project 8 hours ago
templates 440e968661 cont 1 day ago
.gitignore 2468a75f82 excluding pagesheetrank from git 1 year ago
.travis.yml 531c2200eb re-enable notifications from travis 3 months ago
README.mkd 03fe660688 Merge branch 'master' into test 6 months ago
cli cf0c67800d rolling back to old search.py and moving new code to different file 7 months ago
cli.bat 937efcd3c5 cli bat file 3 years ago
cli.py 58b4b0daca Fix cli script to work on Django > 1.7 8 months ago
manage.py bfecf1ad63 cleaned up code 2 years ago
multiserver-monitor.py d7ac90ad6c django setup before running multiserver monitor 8 months ago
package-lock.json 6c37d6cc8f fix back button when coming from search page 2 weeks ago
package.json 6c37d6cc8f fix back button when coming from search page 2 weeks ago
requirements.txt 0fc7f46110 remove pinning of regex version 1 month ago
run a5823bc833 fix ./run to allow simple profiling. add --profile before script name 3 years ago
test 93e521dcb2 By default, only run tests not known to fail. Fix range_list() bug. Update range_list() tests. 2 years ago

README.mkd

New Interfaces for Jewish Texts

Sefaria is creating interfaces, apps (like a source sheet builder) and infrastructure (like an API and a structured dataset) for Jewish texts and textual learning. Our website is up at www.sefaria.org.

You can find outputs of our entire database in Sefaria-Export.

Interested developers should join the sefara-dev mailing list.

For general discussion about the project, please post to the Sefaria Forum.

You can post bugs or request/discuss features on GitHub Issues. Tackling an issue marked as a "Starter Project" is a good way to sink your teeth into Sefaria.

If you're interested in working on a project you see listed here, please email the sefara-dev mailing list.


Getting Started

First clone the Sefaria-Project repository to a directory on your computer, then follow the instructions:

Note: if you are a developer that might want to contribute code to Sefaria, we suggest first making a fork of this respository by clicking the "Fork" button above when logged in to GitHub.

Install Python

Most UNIX systems come with a python interpreter pre-installed.

For Windows:

Go to the Python Download Page and download and install python. Add the python directory to your OS' PATH variable. See here

(Optional) Install virtualenv:

Note: You can perform this step from anywhere in your command line, but it might be easier and tidier to run this step from the root of your project directory that you just cloned. e.g ~/web-projecs/Sefaria-Project $

If you work on many Python projects, you may want to keep Sefaria's python installation separate using Virtualenv. If you're happy having Sefaria requirements in your main Python installation, skip this step.

Install virtualenv then enter these commands:

virtualenv venv --distribute
source venv/bin/activate

Now you should see (venv) in front of your command prompt. The second command sets your shell to use the Python virtual environment that you've just created. This is something that you have to run everytime you open a new shell and want to run the Sefaria demo. You can always tell if you're in the virtual environment by checking if (venv) is at the beginning of your command prompt.

Pip:

If you don't already have it in your Python installation, install pip. Then use it to install the required Python packages.

*Note: this step (and most of the following command line instructions) must be run from the Sefaria-Project root directory*

pip install -r requirements.txt

If you are not using virtualenv, run it with sudo: sudo pip install -r requirements.txt

If you see an error about a missing 'python.h' file, you'll need to install the Python development libraries.

On Debian systems:

sudo apt-get install python-dev

On Fedora systems:

sudo dnf install python2-devel

After installing the Python development libraries, run pip install -r requirements.txt again.

On Windows systems, use instructions here and then make sure that the scripts sub folder of the python installation directory is also in PATH.

Install gettext

gettext is a GNU utility that Django uses to manage localizations.

On Mac:

brew install gettext

On Debian systems

sudo apt-get install gettext

Create a local settings file:

Note: this step must be run from the Sefaria-Project root directory

cd sefaria
cp local_settings_example.py local_settings.py
vim local_settings.py

Replace the placeholder values with values with those matching your environment. For the most part, you should only have to specify values in the top part of the file where it directs you to change the given values.

You can name your local database (sefaria will be the default created by mongorestore below). You can leave SEFARIA_DB_USER ad SEFARIA_DB_PASSWORD blank if you don't need to run authentication on Mongo.

Create a log directory:

Create a directory called log under the project folder. To do this, run mkdir log from the project's root directory. Make sure that the server user has write access to it by using a command such as chmod 777 log.

Get Mongo running:

If you don't already have it, install MongoDB. Our current data dump requires MongoDB version 2.6 or later. After installing Mongo, run the mongo daemon with:

sudo mongod

Put some texts in your database:

We make a MongoDB dump of our database is available download. The complete dump is available at https://storage.googleapis.com/sefaria-mongo-backup/dump.tar.gz . The complete dump includes a history collections which includes a complete revision history of every text our library. For many applications this data is not relevant. A small dump which exclude history is available at: https://storage.googleapis.com/sefaria-mongo-backup/dump_small.tar.gz . We recommend using the smaller dump unless you're specifically interested in texts revision history within Sefaria.

Once you've download and unzipped this content, from the parent directory which contains dump run:

mongorestore --drop

This will create (or overwrite) a mongo database called sefaria.

If you have used dump_small.tar.gz, use the mongo client shell, or a GUI you have installed to create an empty collection inside the sefaria database called history.

Set up Django's local server

manage.py is used to run and to manage the local server. It is located in the root directory of the Sefaria-Project code base.

Django auth features run on a separate database. To init this database and set up Django's auth system, switch to the root directory of the Sefaria-Project code base, and run (from the project root):

python manage.py migrate

Run the development server:

python manage.py runserver

You can also make it publicly available by specifying 0.0.0.0 for the host:

python manage.py runserver 0.0.0.0:8000

Get Node:

Note: Older versions of Node and npm ran into a file name length limit on Windows OS. This problem should be mitigated in newer versions on Windows 10.

Node is now required to run the site because we are using Webpack to bundle our javascript. To install node and npm, see here.

For the common Linux distributions such as Debian, Ubuntu and Linux Mint, you are better off following the instructions here. They will install both Node and npm.

Now download the required Javascript libraries and install some global tools for development with the setup script (from the project root).

npm install
sudo npm run setup

Create a local settings file for node and tell it what port to run on and where to find the Django server. The port should match the NODE_HOST variable set in Django's local_settings.py.

cp node/local_settings_example.json node/local_settings.json
vim node/local_settings.json

Run Webpack

To get the site running, you need to bundle the javascript with Webpack. Run:

npm run build-client

to bundle once. To watch the javascript for changes and automatically rebuild, run:

npm run watch-client

Server-side rendering with Node:

Sefaria uses React.js. To render HTML server-side, we use a Node.js server. For development, the site is fully functional without server-side rendering. For deploying in a production environemnet however server side HTML is very important for bots and SEO.

For development, you can run the Node server using nodemon with:

npm start

You also need to set

USE_NODE = True

in Django's local_settings.py. To run webpack with server-side rendering, use:

npm run build

or

npm run watch

Command Line Interface

The shell script cli will invoke a python interpreter with the core models loaded, and can be used as a standalone interface to texts or for testing.

$ ./cli
>>> p = LinkSet(Ref("Genesis 13"))
>>> p.count()
226

Thanks

We're grateful to the following orgazations for providing us with donated services:

License

GPL