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

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