Collections is a prototype project at the Center for Open Science. This project is experimental, scope, technologies, code and functionality may change. This app has two main parts. The service stores data about the collection, and the client lets users interact with their collections.
You will need the following things properly installed on your computer.
$ git clone [email protected]:cos-labs/collections-service.git
$ cd collections-service
Setting up a virtual environment for Python 3 is recommended.
$ pyenv virtualenv 3.6.0 osf-collections
$ pip install -r requirements.txt
$ brew install postgres
$ createdb
$ brew services postgres start
OSF Collections uses Redis as a database for celery tasks, as well as a cache.
$ brew install redis
$ brew services start redis
Tika is an apache product that allows for scraping text from a very large variety of file formats. Collections uses it to provide full-text search on documents that are created in collections.
$ brew install tika
Note this may require installing xcode command line tools.
Now that tika is installed, create a launch daemon to make starting and stopping tika more simple, and load it in so launchctl knows about it.
$ cp <collections-service>/apache.tika.plist /Library/LaunchDaemons/apache.tika.plist
$ launchctl load /Library/LaunchDaemons/apache.tika.plist
Now tika can be started and stopped using
$ launchctl start apache.tika
$ launchctl stop apache.tika
Simply export the Sendgrid token in the environment so Django can pick it up
export SENDGRID_API_KEY='SG.the_key_given_to_you_by_sendgrid'
$ cd {collections}/
(SA
refers to "Social App", SU
to Superuser)
SA_CLIENT_ID = "55b229c83f6946fe8c16b86217781028"
SA_CLIENT_SECRET = "70z9QBGWmYlFoXUr6HYZoi3QPr4ksafSEbJvTyNr"
SA_APPLICATION_NAME = "Collections"
SA_SITE_ID = 1
SA_PROVIDER_NAME = "osf"
SU_USERNAME = "admin"
SU_PASSWORD = "password"
SU_EMAIL = ""
$ ./manage.py migrate
$ ./reset
$ python manage.py runserver
Visit the api at http://localhost:8000/api/
or admin panel at http://localhost:8000/admin/
.
Follow the set-up instructions in the README for https://github.com/cos-labs/collections.
Visit your app at http://localhost:4200.
Set up the backend to use either staging or prod. Do this in the sessions for both the client and the service. export BACKEND=prod
or export BACKEND=stage
Create a developer app at https://staging.osf.io/settings/applications/ with the following settings:
- Project homepage URL: http://localhost:8000/
- Callback URL: http://localhost:8000/accounts/osf/login/callback/
$ python manage.py createsuperuser
Create a new Site with domain name: http://localhost:8000/ in the django admin panel:
- Note: The site id must match the
SITE_ID
variable defined inSITE_ID
should be set to the site id incollections-service/service/settings/local.py
- The SITE_ID can be found in the URL
- You may have to define SITE_ID in the local.py file
- Set provider to "Open Science Framework"
- Set the client id and secret key to the ones defined in your developer app
- Select http://localhost:8000/ as the site
python manage.py rebuild_index
- This needs to be done on first run / population and then on a semi-regular basis when running the API to index new content from the API.
- Before moving forward, make sure you've logged into the test server using your OSF staging credentials.
- To populate the database with users, meetings, collections, and items, run
$ python populate.py
from the project root.
python manage.py test