The goal of gitensite is to:
-
provide information about the GITenberg project
-
document the major areas of work of GITenberg
-
connect visitor with areas to contribute
-
list information about GITenberg books
-
distribute completed ebooks
This is a django/python project, so you are going to want to use some standard python dev tools.
Copy example.env
to .env
and store your local db secret and other values there.
Load that file into your environment with:
source .env
Virtual environments in python are a way of separating and reproducing the python package requirements.
From the root of the project
sudo pip install virtualenv virtualenv venv source venv/bin/activate pip install -r requirements.txt
For every new terminal, or when returning to work on the project, you will need to run
source venv/bin/activate
On OSX, apple occasionally moves cffi’s location, which bcrypt depends on. This causes pip to fail when installing. Deactive your virtualenv, set a bash variable, and install system-wide.
$ # Instal homebrew. See http://brew.sh $ # Install cffi. See https://cffi.readthedocs.org/en/latest/#macos-x # you may need to find and set include_dirs in setup.py $ brew install pkg-config libffi $ pip install bgcrypt $ source venv/bin/activate
We use Postgres.
To start a local db run:
./manage.py migrate ./manage.py createsuperuser
If you have modified the database, generate new database migrations:
./manage.py makemigrations
And run them with:
./manage.py migrate
To fill out data in your local db, you’ll first need to download and unpack the Project Gutenberg RDF metadata. you can run the provided load_repos
management command:
from https://www.gutenberg.org/cache/epub/feeds/rdf-files.tar.zip
Then run ./manage.py load_repos <rdf_library_path>
Where <rdf_library_path>
is the address where you unzipped the rdf metadata
There are currently three apps in the project:
-
content for containing templates and views for website pages
-
bookrepo [deprecated] for interacting with github and storing info about books
-
bookinfo for metadata for the repos
this website is deployed on Elastic Beanstalk. The main difficulty has been managing python dependencies- EB doesn’t manage nested dependencies, so you have to stage the install. To load up the initial database, push the metadata feed from pg along with the install, then
eb ssh
into an instance, then execute
cd /opt/python/current source ./env sudo mkdir -m 777 tmp unzip ./app/assets/rdf-files.tar.zip -d ./tmp cd tmp tar -xf rdf-files.tar cd .. python ./app/manage.py load_repos /opt/python/current/tmp/cache/epub