You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+66-2Lines changed: 66 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,14 @@ At any time, you can still load the example projects:
43
43
stave load-samples
44
44
```
45
45
46
+
By default the Stave server runs at http://localhost:8888. If you need to switch the port, you can add `-n` to specify the port number. For example, the following command will start a Stave service at http://localhost:8002.
47
+
```bash
48
+
stave start -n 8002
49
+
```
50
+
For more options to start Stave server, refer to:
51
+
```bash
52
+
stave start -h
53
+
```
46
54
#### Stave Configuration
47
55
After you start the Stave server, a `.stave/` folder is automatically created under your home directory `~`. It has the following structure:
48
56
```
@@ -60,12 +68,68 @@ You may follow the prompts to interactively set up the configuration:
60
68
```bash
61
69
stave config -i
62
70
```
63
-
For more information, refer to:
71
+
Stave CLI allows you to configure the database file, log file, the allowed hosts, etc. For more options, run
64
72
```bash
65
73
stave config -h
66
74
```
75
+
and you shall see the following help message:
76
+
```bash
77
+
usage: stave config [-h] [-i] [-s DJANGO_SETTINGS_MODULE] [-d DB_FILE]
Module path to settings.py of django project. If you
86
+
have not set up any django project, you should leave
87
+
this field empty and stave will use its default
88
+
configuration. To set this field you should already
89
+
have a django project and the 'settings.py' file under
90
+
your project must be accessible from PYTHONPATH so
91
+
that django can import it as a module. Example:
92
+
'myproject.settings'
93
+
-d DB_FILE, --db-file DB_FILE
94
+
Path to database file of Stave
95
+
-l LOG_FILE, --log-file LOG_FILE
96
+
Path to log file for logging
97
+
-a ALLOWED_HOSTS [ALLOWED_HOSTS ...], --allowed-hosts ALLOWED_HOSTS [ALLOWED_HOSTS ...]
98
+
A list of strings representing the host/domain names
99
+
that stave can serve.
100
+
```
101
+
For example, you can change the path of database file by running:
102
+
```bash
103
+
stave config -d~/db.sqlite3
104
+
```
105
+
You may also add your own host names to the allowed hosts that Stave can serve:
106
+
```bash
107
+
stave config -a localhost myhost1.com myhost2.com
108
+
```
109
+
110
+
#### Import and Export
111
+
Stave provides a set of interfaces that allow you to import/export projects from/to disk. This is useful when you need to transfer Stave projects between backend database and local storage.
112
+
113
+
To export a project, you need to specify the path to store the project and its database id (which can be retrieved from URL, e.g., the id of project at http://localhost:8888/project/3 is 3). For example, the following command will save project with `id=3` to `~/project_3`:
114
+
```bash
115
+
stave export~/project_3 3
116
+
```
117
+
Note that you will be prompted to enter your username and password before moving forward.
118
+
119
+
Now that you've saved a Stave project to a directory, you can either render this project in viewer mode
120
+
```bash
121
+
stave start -o -p ~/project_3
122
+
```
123
+
or import it to the database (which also requires authentication with username and password)
124
+
```bash
125
+
stave import ~/project_3
126
+
```
127
+
`stave import` is also useful when you use [StaveProcessor](https://github.com/asyml/forte/blob/master/forte/processors/stave/stave_processor.py#L46) inside a forte pipeline and want to save the generated visualization to database. `StaveProcessor` normally would save a Stave project to a folder (by default the name of folder is `Auto generated project`), and you can import this folder into stave backend by running
128
+
```bash
129
+
stave import PATH_TO_STAVE_PROJECT
130
+
```
67
131
68
-
#### More about the command line tool:
132
+
#### More about the command line tool
69
133
To learn more about Stave CLI, run the following command to see the help message:
0 commit comments