]> code.communitydata.science - taguette_google_sheet_integration.git/blob - README.md
added support for merging and deleting tags
[taguette_google_sheet_integration.git] / README.md
1 ## Step 0: Setup
2
3 If you have not already done so, please edit the file `.taguette_gdocs` in this
4 directory. You must enter ever variable marked with "CHANGME." You only need to
5 do this once.
6
7 In order to not commit your changes into git, you can run this command:
8
9 ```
10 git update-index --assume-unchanged .taguette_gdocs
11 ```
12
13 I also create a directory called `taguette_backups` and one called `exported_tags` like:
14
15 ```
16 mkdir taguette_backups
17 mkdir exported_tags
18 ```
19
20 ## Step 1: Backing things up
21
22 Do this every time before you run the script:
23
24 ```
25 sudo systemctl stop taguette
26 BACKUP_FILE="taguette-snapshot-$(date +%Y%m%d-%H%M%S).sqlite3"
27 sudo cp /var/lib/taguette/taguette.sqlite3 "taguette_backups/$BACKUP_FILE"
28 cp "taguette_backups/$BACKUP_FILE" ./taguette-working.sqlite3
29 ```
30
31 The first line shuts down Taguette. The second line just creates the backup
32 file name. The third and fourth lines will create a new backup file and copy the
33 backup file into the `./taguette-working.sqlite3`.
34
35 ### Step 2a: Import from Google Sheets into the database
36
37 If everything is setup well, you should just need to run:
38
39 ```
40 python3 taguette-update_tags_from_sheet.py
41 ```
42
43 Check for errors! If you don't see any, you will need to copy the database back
44 like:
45
46 ```
47 sudo cp ./taguette-working.sqlite3 /var/lib/taguette/taguette.sqlite3
48 sudo chown taguette:taguette /var/lib/taguette/taguette.sqlite3
49 ```
50
51 ### Step 2b: Exporting from the database
52
53 Exporting tags should be as easy as:
54
55 ```
56 python3 taguette-export_tags_to_csv.py
57 ```
58
59 This will create a new file called `exported_tags.tsv` which you can manually
60 move into the spreadsheet.
61
62 ## Step 3: Restarting Taguette
63
64 Once everything looks good, go ahead and restart Taguette like:
65
66 ```
67 sudo systemctl start taguette
68 ```
69
70 You can check it with `systemctl status taguette` but keep in mind it takes
71 some time startup.
72
73

Community Data Science Collective || Want to submit a patch?