An open source Question/Answer platform inspired by Stack Overflow. On the server side it uses
- Python 2.7
- Django
- Graphene (GraphQL)
- PyTest
And on the client side
- React
- Blueprint.js
- Apollo
- Webpack
This aims to have near complete feature set with a Q/A platform akin to Stack Overflow or Quora. Users have the ability to ask questions, and other users can add answers to the questions. Users can also add comments to both questions and answers. The question OP can approve an answer. Users can also up/down vote comments, answers, and questions.
The project is considered in early development mode and does not have full functionality.
The easiest way to install is to use Docker and Docker Compose. You will have to make some modifications prior to running to get full functionality.
-
Authentication
The default configuration uses social-app-django with Google Oauth2. These environment variables need to be set
GOOGLE_OAUTH_KEY GOOGLE_OAUTH_SECRET
Please change to an appropriate backend for your use.
-
Database
The default database is a PostgreSQL database reachable at the
df-postgres
host at port 5432. Change theDATABASES
section insettings.py
to customize.
To run DoubleFault in a Docker container
docker-compose up
This will execute start.sh
which
- Run migrations
- Creates the client bundle using
webpack
. - Starts a gunicorn server in the container bound to
0.0.0.0:8080
.
The webserver should be accessible from your host at localhost:8080
, assuming no
other services are using ports 8080 and 5432.
It is recommended to use Docker in your development process for environment parity. Enter the container shell with something like
docker-compose run --service-ports web bash
Then within the Docker container you can use webpack to watch your client code
# ./node_modules/.bin/webpack --config webpack.config.js --watch &
load some initial testing fixtures
# ./manage.py loaddata tests/test_fixtures.json
and run the Django webserver
# ./manage.py runserver 0.0.0.0:8080
The schema used by Graphene is located in web/schema/*
. There are separate files for
types, queries, and mutations. The mutations should be complete and allow for creating/editing
of questions, answers, and comments.
pip-tools is used to manage dependencies. Any new
dependencies should be added to requirements.in
and compiled using
pip-compile --output-file requirements.txt requirements.in
pytest is used for testing instead of the default Django test runner. Use the test_settings.py
settings for running tests with Sqlite3 instead of posgres.
pytest --ds=test_settings tests
running pdbpp
pytest --pdb --ds=test_settings tests
Updating snapshots
pytest --ds=test_settings --snapshot-update tests