This is the typical command you should do to get started:
python -m venv venv/ # Create virtualenv
source venv/bin/activate # Activate virtualenv
pip install -e ".[dev]" # Install dev requirements
pre-commit install # Install pre-commit hook framework
python manage.py migrate # Create database
python manage.py loaddata survey/tests/testdump.json # Load test data
python manage.py createsuperuser
python manage.py runserver # Launch server
Please note that pre-commit
will permit to fix a lot of linting error automatically
and is not required but highly recommended.
python manage.py test survey
If you want to dump a test database after adding data to it, this is the command to have a minimal diff :
python manage.py dumpdata --format json -e contenttypes -e admin -e auth.Permission
-e sessions.session -e sites.site --natural-foreign --indent 1
-o survey/tests/testdump.json
coverage run --source=survey --omit=survey/migrations/* ./manage.py test
coverage html
xdg-open htmlcov/index.html
We're using pre-commit
, it should take care of linting during commit.
Django survey's is available in multiple language. Your contribution would be very appreciated if you know a language that is not yet available.
If your language does not exist add it in the LANGUAGE
variable in the settings, like
here.
Do not forget to credit yourself like in the header seen
here
Then you can translate with :
python manage.py makemessages
# python manage.py createsuperuser ? (You need to login for rosetta)
python manage.py runserver
# Access http://localhost:8000/admin to login
# Then go to http://localhost:8000/rosetta to translate
python manage.py makemessages --no-obsolete --no-wrap --ignore venv --locale de \
--locale es --locale fr --locale id --locale ja --locale nl --locale pl \
--locale pt --locale ru --locale tr --locale zh --locale gr
git add survey/locale/
...
If your language is not yet available in rosetta, this stack overflow question should work even for language not handled by django.
If you're not a developer, open an issue on github and ask for a .po file in your language. I will generate it for you, so you can edit it with an online editor. I will then create the .po and commit them, so you can edit them with your github account or integrate it myself if you do not have one. You will be credited here.