hera-api $ touch web/hera/secrets.py
# paste the secrets you get into this file
hera-api $ docker volume create heradb-vol
hera-api $ docker compose up --build
Browsable API docs is now available at your localhost http://127.0.0.1:8000/api_docs/redoc/. You can also play around with the APIs, for example by visiting User Profiles API.
hera-api $ docker compose run web python manage.py migrate
If you are using TablePlus app, go to Connection > New > Import from URL and paste the following:
postgresql://herauser:[email protected]/heradb?statusColor=F8F8F8&enviroment=local&name=Docker%20PG&tLSMode=0&usePrivateKey=false&safeModeLevel=0&advancedSafeModeLevel=0
Prefix docker compose run web
to your usual Django commands.
# django-admin example
docker compose run web django-admin startapp api
# manage.py example to create superuser to login to admin panel
docker compose run web python manage.py createsuperuser
hera-api $ cd web
hera-api/web $ pipenv install your-new-library;
hera-api/web $ pipenv lock --requirements > requirements.txt
hera-api/web $ docker compose up --build; # make sure to add --build flag to update docker image
# You need docker compose up to get PostgreSQL running as it's used for test database
hera-api $ docker compose up [--build] # --build only if you have modified requirements.txt
# Run tests as many times as you like:
hera-api $ docker compose run web python manage.py test
hera-api $ docker compose run web python manage.py flush
Run in your local computer with GNU Gettext installed:
docker-compose run web django-admin makemessages -l tr -l ar
This will generate the the django.po
files. Translate them and do test the compilation with
docker-compose run web django-admin compilemessages
However, by default, .mo
(compiled messages) files are ignored by .gitignore
. Therefore, for the deployment, we have to run copilot svc exec
, then
``django-admin compilemessages`.
For code style guidelines, please read CONTRIBUTING.md.
It is required to run migration for 2FA to work.
docker compose run web python manage.py migrate
To enable 2FA for admin,
- Visit
account/login/
- Login admin, then will lead to
account/two_factor/
- Enable the 2FA and setup the authenticator such as Authy
- Then can visit the admin page at
admin/
- Run
copilot deploy