/Dennett

Backend de Moravec

Primary LanguagePythonMIT LicenseMIT

Dennett

Moravec Backend. Learn more about this project:

Working on this project

First make sure you have VirtualEnvWrapper and MongoDB installed.

Create python virtual environment

mkvirtualenv dennett
workon dennett
pip install -r requirements.txt

Create configuration file

Create a file containing these environment variables:

DEVELOPMENT=True
DEBUG=True
TESTING=False
DB_COLLECTION_V1=data-v1
DB_COLLECTION_V2=data-v2
MONGO_DBNAME=your-mongo-database-name
MONGO_URI=your-mongo-uri
SECRET_KEY=some-secret-key

For example, some possible values for the last three variables could be:

MONGO_DBNAME=dennett
MONGO_URI=mongodb://localhost:27017/dennett
SECRET_KEY=642342617b264d49b5bb4facc4b3124fa8ac8f5781ad2219

You can create that file anywhere in your filesystem. A suggested location could be ~/dennett/config/develop In any case, make sure NOT to track this file with git.

Run the development server

workon dennett
export $(cat ~/dennett/config/develop) # replace path with location of your configuration file
python app.py # run development server

Populate database

With the development server already running, open a new terminal and type:

workon dennett
export $(cat ~/dennett/config/develop) # replace path with location of your configuration file
python populate.py 

Run tests

WARNING: Running the test suite will destroy local database!

With the development server already running, open a new terminal and type:

pytest

Usage

POSTing new trials

This server accepts any JSON input on URL api/v2/trials. No format/schema validation is done.

How to contribute

Contributions are more than welcome. Here's a list of fundamenetal knowledge you'll need to get started.

Python

Git

Command line