License: | MIT |
---|
Democrasite is a website which automatically merges changes based on popular approval. For more information on the nature and purpose of the project, visit our about page. This page is meant for people who want to clone the repository and contribute to the project. This project is approximately in beta development (hence the repository being named "cookiestocracy" - a reference to cookiecutter and kakistocracy). The alpha version is here and the full version doesn't exist yet.
- Homepage: https://democrasite.herokuapp.com
- Source code: https://github.com/mfosterw/cookiestocracy
- Documentation: https://cookiestocracy.readthedocs.io/en/latest/
The easiest way to explore the repository is to open it in GitHub Codespaces with the button above. Once you've given the container some time to set up (it should take about three minutes), navigate to the ports tab right above the terminal and hover over port 3000, then click on the browser icon that appears. You should see the development version of the homepage! (With no data yet, see below).
Please read the contribution guide to set up a local development environment with Docker. See basic commands below, which can be run from within a dev container or by following the instructions in the guide.
To view the logs from the server process on the backend (django's runserver
) run:
$ docker logs -f democrasite-local-django
For logs from the frontend server (next dev
), run:
$ docker logs -f democrasite-local-node
Note that the dev container runs from the backend server, so Django management commands can be run normally.
To load some initial sample data into the database, run:
$ python manage.py loaddata initial.json
To create a superuser account to log into the admin at localhost:8000/admin, use this command:
$ python manage.py createsuperuser
To test logging in with a third party provider, you will need OAuth keys from the provider you're using. See the information on django-allauth for GitHub and Google keys respectively, and once you have the keys set the environment variables
<provider>-CLIENT-ID
and<provider>-SECRET
in both.envs/.local/.django
and.envs/.local/.node
and then rebuild the container. Once it is rebuilt, log in through your provider with the button on the homepage. For convenience, you can keep your normal user logged in on Chrome and your superuser logged in on Firefox (or your browsers of choice), so that you can see how the site behaves for both kinds of users.Note
Accounts created through the admin page do not have a way to sign in on the frontend since there is no login page. To test working with accounts on the frontend, please login through a social provider.
Running type checks with mypy:
$ mypy democrasite
$ pytest
To run the tests, check your test coverage, and generate an HTML coverage report:
$ coverage run -m pytest $ coverage html $ open htmlcov/index.html