Browse Source

Update getting-started.md

pull/684/head
Hiroki Nakayama 4 years ago
committed by GitHub
parent
commit
96a0af7021
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 50 additions and 60 deletions
  1. 110
      docs/getting-started.md

110
docs/getting-started.md

@ -1,102 +1,92 @@
# Getting started
## Quick install guide
First of all, you have to clone the repository:
## Usage
```bash
git clone https://github.com/doccano/doccano.git
cd doccano
```
Two options to run doccano:
To install doccano, there are three options:
- (Recommended) Docker Compose
- Docker
### Option1: Pull the production Docker image
### Docker Compose
```bash
docker pull doccano/doccano
$ git clone https://github.com/doccano/doccano.git
$ cd doccano
$ docker-compose -f docker-compose.prod.yml up
```
### Option2: Pull the development Docker-Compose images
Go to <http://0.0.0.0/>.
```bash
docker-compose pull
_Note the superuser account credentials located in the `docker-compose.prod.yml` file:_
```yml
ADMIN_USERNAME: "admin"
ADMIN_PASSWORD: "password"
```
### Option3: Setup Python environment
> Note: If you want to add annotators, see [Frequently Asked Questions](https://github.com/doccano/doccano/wiki/Frequently-Asked-Questions#i-want-to-add-annotators)
First we need to install the dependencies. Run the following commands:
_Note for Windows developers: Be sure to configure git to correctly handle line endings or you may encounter `status code 127` errors while running the services in future steps. Running with the git config options below will ensure your git directory correctly handles line endings._
```bash
pip install -r requirements.txt
cd app
git clone https://github.com/doccano/doccano.git --config core.autocrlf=input
```
Next we need to start the webpack server so that the frontend gets compiled continuously.
Run the following commands in a new shell:
### Docker
As a one-time setup, create a Docker container for Doccano:
```bash
cd server/static
npm install
npm run build
# npm start # for developers
cd ..
docker pull doccano/doccano
docker container create --name doccano \
-e "ADMIN_USERNAME=admin" \
-e "ADMIN_EMAIL=admin@example.com" \
-e "ADMIN_PASSWORD=password" \
-p 8000:8000 doccano/doccano
```
## Usage
Let’s start the development server and explore it.
Depending on your installation method, there are two options:
### Option1: Running the Docker image as a Container
First, run a Docker container:
Next, start Doccano by running the container:
```bash
docker run -d --name doccano -p 8000:80 doccano/doccano
docker container start doccano
```
Then, execute `create-admin.sh` script for creating a superuser.
To stop the container, run `docker container stop doccano -t 5`.
All data created in the container will persist across restarts.
```bash
docker exec doccano tools/create-admin.sh "admin" "admin@example.com" "password"
```
Go to <http://127.0.0.1:8000/>.
### Option2: Running the development Docker-Compose stack
### For Developers
We can use docker-compose to set up the webpack server, django server, database, etc. all in one command:
You can setup local development environment as follows:
```bash
docker-compose up
$ git clone https://github.com/doccano/doccano.git
$ cd doccano
$ docker-compose -f docker-compose.dev.yml up
```
Now, open a Web browser and go to <http://127.0.0.1:8000/login/>. You should see the login screen:
![Login form](./login_form.png)
Go to <http://127.0.0.1:3000/>.
### Option3: Running Django development server
Or, you can setup via Python and Node.js:
Before running, we need to make migration. Run the following command:
### Python
```bash
python manage.py migrate
$ git clone https://github.com/doccano/doccano.git
$ cd doccano/app
$ pip install -r requirements.txt
$ python manage.py migrate
$ python manage.py create_roles
$ python manage.py create_admin --noinput --username "admin" --email "admin@example.com" --password "password"
$ python manage.py runserver
```
Next we need to create a user who can login to the admin site. Run the following command:
### Node.js
```bash
python manage.py create_admin --noinput --username "admin" --email "admin@example.com" --password "password"
$ cd doccano/frontend
$ yarn install
$ yarn dev
```
Developers can also validate that the project works as expected by running the tests:
```bash
python manage.py test server.tests
```
Finally, to start the server, run the following command:
```bash
python manage.py runserver
```
Go to <http://127.0.0.1:3000/>.
Loading…
Cancel
Save