Skip to content

Commit dc6028b

Browse files
committed
Add option to auto-create admin
1 parent 7e30a1e commit dc6028b

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,11 @@ Depending on your installation method, there are two options:
130130
First, run a Docker container:
131131

132132
```bash
133-
docker run -d --name doccano -p 8000:8000 chakkiworks/doccano
134-
```
135-
136-
Then, execute `create-admin.sh` script for creating a superuser.
137-
138-
```bash
139-
docker exec doccano tools/create-admin.sh "admin" "[email protected]" "password"
133+
docker run -d --name doccano \
134+
-e "ADMIN_USERNAME=admin" \
135+
136+
-e "ADMIN_PASSWORD=password" \
137+
-p 8000:8000 chakkiworks/doccano
140138
```
141139

142140
**Option2: Running Django development server**

tools/run.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,9 @@ if [[ ! -d "app/staticfiles" ]]; then python app/manage.py collectstatic --noinp
66

77
python app/manage.py wait_for_db
88
python app/manage.py migrate
9+
10+
if [[ -n "${ADMIN_USERNAME}" ]] && [[ -n "${ADMIN_EMAIL}" ]] && [[ -n "${ADMIN_PASSWORD}" ]]; then
11+
python app/manage.py create_admin --noinput --username="${ADMIN_USERNAME}" --email="${ADMIN_EMAIL}" --password="${ADMIN_PASSWORD}"
12+
fi
13+
914
gunicorn --bind="0.0.0.0:${PORT:-8000}" --workers="${WORKERS:-1}" --pythonpath=app app.wsgi --timeout 300

0 commit comments

Comments
 (0)