1
- # Creative Commons Licenses
1
+ # cc-legal-tools-app-app
2
2
3
+ ** Creative Commons (CC) Legal Tools Application.** This repository contains the
4
+ application that manages the licenses and public domain declarations (static
5
+ HTML, internationalization and localization files, etc.). It consumes and
6
+ generates data in the [ creativecommons/cc-legal-tools-data] [ repodata ]
7
+ repository.
3
8
4
- ## Licenses and Public Domain Declarations
9
+ Other CC legal tools include:
10
+ - [ creativecommons/chooser] [ chooser ] : The new and improved CC license
11
+ selection tool.
12
+ - [ creativecommons/legaldb] [ legaldb ] : CC Legal Database: curated repository of
13
+ Case Law and Scholarship data from around the world in a Django based
14
+ websitee
5
15
6
- The project title, * Creative Commons Licenses* , has been shortened for
7
- convenience. This project also includes the Public Domain Declarations.
16
+ [ repodata ] :https://github.com/creativecommons/cc-legal-tools-data
17
+ [ chooser ] : https://github.com/creativecommons/chooser/
18
+ [ legaldb ] : https://github.com/creativecommons/legaldb
8
19
9
20
10
21
## Not the live site
@@ -14,8 +25,8 @@ Though if it's deployed on a public server it could do that, performance would
14
25
probably not be acceptable.
15
26
16
27
Instead, a command line tool can be used to save all the rendered HTML pages
17
- for licenses and deeds as files. Then those files are used as part of the real
18
- creativecommons.org site, just served as static files. See details farther
28
+ for deeds and legal code as files. Then those files are used as part of the
29
+ real creativecommons.org site, just served as static files. See details farther
19
30
down.
20
31
21
32
For the parent project for the entire creativecommons.org site (of which this
@@ -41,20 +52,20 @@ Both versions are specified in the [`Pipfile`](Pipefile).
41
52
42
53
### Data Repository
43
54
44
- The [ creativecommons/cc-licenses- data] [ repodata ] project repository should be
45
- cloned into a directory adjacent to this one:
55
+ The [ creativecommons/cc-legal-tools- data] [ repodata ] project repository should
56
+ be cloned into a directory adjacent to this one:
46
57
```
47
58
PARENT_DIR
48
- ├── cc-licenses
49
- └── cc-licenses -data
59
+ ├── cc-legal-tools-app-app
60
+ └── cc-legal-tools -data
50
61
```
51
62
52
63
If it is not cloned into the default location, the Django
53
64
` DATA_REPOSITORY_DIR ` django configuration setting, or the
54
65
` DATA_REPOSITORY_DIR ` environment variable can be used to configure its
55
66
location.
56
67
57
- [ repodata ] :https://github.com/creativecommons/cc-licenses -data
68
+ [ repodata ] :https://github.com/creativecommons/cc-legal-tools -data
58
69
59
70
60
71
### Docker Compose Setup
@@ -68,7 +79,7 @@ Use the following instructions to start the project with Docker compose.
68
79
Compose | Docker Documentation] [ installcompose ] )
69
80
3 . Create Django local settings file
70
81
```
71
- cp cc_licenses /settings/local.example.py cc_licenses /settings/local.py
82
+ cp cc_legal_tools /settings/local.example.py cc_legal_tools /settings/local.py
72
83
```
73
84
4. Build the containers
74
85
```
@@ -97,11 +108,11 @@ The commands above will create 3 docker containers:
97
108
long as the development server is running.
98
109
2. **db**: PostgreSQL database backend for this Django application
99
110
3. **static** ([127.0.0.1:8080](http://127.0.0.1:8080/)): a static web server
100
- serving [creativecommons/cc-licenses -data][repodata]/docs.
111
+ serving [creativecommons/cc-legal-tools -data][repodata]/docs.
101
112
102
113
[installdocker]: https://docs.docker.com/engine/install/
103
114
[installcompose]: https://docs.docker.com/compose/install/
104
- [repodata]:https://github.com/creativecommons/cc-licenses -data
115
+ [repodata]:https://github.com/creativecommons/cc-legal-tools -data
105
116
106
117
107
118
### Manual Setup
@@ -137,7 +148,7 @@ The commands above will create 3 docker containers:
137
148
2. Configure Django and PostgreSQL
138
149
1. Create Django local settings file
139
150
```
140
- cp cc_licenses /settings/local.example.py cc_licenses /settings/local.py
151
+ cp cc_legal_tools /settings/local.example.py cc_legal_tools /settings/local.py
141
152
```
142
153
2. Start PostgrSQL server
143
154
- It's completely fine to not make a specific postgresql account. But if
@@ -155,11 +166,11 @@ The commands above will create 3 docker containers:
155
166
3. Create project database
156
167
- Linux:
157
168
```
158
- sudo createdb -E UTF-8 cc_licenses
169
+ sudo createdb -E UTF-8 cc_legal_tools
159
170
```
160
171
- macOS:
161
172
```
162
- createdb -E UTF-8 cc_licenses
173
+ createdb -E UTF-8 cc_legal_tools
163
174
```
164
175
4. Load database schema
165
176
```
@@ -214,7 +225,7 @@ Best run before every commit:
214
225
215
226
Esoteric and dangerous:
216
227
- `./dev/concatenatemessages.sh` - Concatenate legacy ccEngine translations
217
- into cc-licenses
228
+ into cc-legal-tools-app
218
229
- rarely used (only after source strings are updated)
219
230
- `./dev/resetdb.sh` - Reset Django application database data (!!DANGER!!)
220
231
- usually only helpful if you're doing model/schema work
@@ -249,17 +260,17 @@ you commit, try adding your files (`git add <FILES>`) prior to committing them.
249
260
250
261
## Data
251
262
252
- The license metadata is in a database. The metadata tracks which licenses
253
- exist, their translations, their ports, and their characteristics like what
254
- they permit, require, and prohibit.
263
+ The legal tools metadata is in a database. The metadata tracks which legal
264
+ tools exist, their translations, their ports, and their characteristics like
265
+ what they permit, require, and prohibit.
255
266
256
267
The metadata can be downloaded by visiting URL path:
257
268
`127.0.0.1:8000`[`/licenses/metadata.yaml`][metadata]
258
269
259
270
[metadata]: http://127.0.0.1:8000/licenses/metadata.yaml
260
271
261
272
There are two main models (Django terminology for tables) in
262
- [`licenses /models.py`](licenses /models.py):
273
+ [`legal_tools /models.py`](legal_tools /models.py):
263
274
1. `LegalCode`
264
275
2. `Licenses`
265
276
@@ -269,12 +280,12 @@ prohibitions; a `version` (ex. `4.0`, `3.0)`, and an optional `jurisdiction`
269
280
for ports. So we might refer to the license by it's **identifier** "BY 3.0 AM"
270
281
which would be the 3.0 version of the BY license terms as ported to the Armenia
271
282
jurisdiction. For additional information see: [**Legal Tools Namespace** -
272
- creativecommons/cc-licenses- data: CC Licenses data (static HTML, language
283
+ creativecommons/cc-legal-tools- data: CC Legal Tools Data (static HTML, language
273
284
files, etc.)][namespace].
274
285
275
286
There are three places legal code text could be:
276
287
1. **gettext files** (`.po` and `.mo`) in the
277
- [creativecommons/cc-licenses -data][repodata] repository (legal tools with
288
+ [creativecommons/cc-legal-tools -data][repodata] repository (legal tools with
278
289
full translation support):
279
290
- 4.0 Licenses
280
291
- CC0
@@ -293,8 +304,8 @@ Documentation:
293
304
- [Models | Django documentation | Django][djangomodels]
294
305
- [Templates | Django documentation | Django][djangotemplates]
295
306
296
- [namespace]: https://github.com/creativecommons/cc-licenses -data#legal-tools-namespace
297
- [unportedtemplate]: licenses/ templates/includes/legalcode_licenses_3.0_unported.html
307
+ [namespace]: https://github.com/creativecommons/cc-legal-tools -data#legal-tools-namespace
308
+ [unportedtemplate]: templates/includes/legalcode_licenses_3.0_unported.html
298
309
[cctransifex]: https://www.transifex.com/creativecommons/public/
299
310
[djangomodels]: https://docs.djangoproject.com/en/3.2/topics/db/models/
300
311
[djangotemplates]: https://docs.djangoproject.com/en/3.2/topics/templates/
@@ -310,7 +321,7 @@ need to be repeated after that.
310
321
311
322
The implementation is the Django management command `load_html_files`, which
312
323
reads from the legacy HTML legal code files in the
313
- [creativecommons/cc-licenses -data][repodata] repository, and populates the
324
+ [creativecommons/cc-legal-tools -data][repodata] repository, and populates the
314
325
database records and translation files.
315
326
316
327
`load_html_files` uses [BeautifulSoup4][bs4docs] to parse the legacy HTML legal
@@ -333,14 +344,14 @@ code:
333
344
`LegalCode` model
334
345
335
346
[bs4docs]: https://www.crummy.com/software/BeautifulSoup/bs4/doc/
336
- [repodata]: https://github.com/creativecommons/cc-licenses -data
347
+ [repodata]: https://github.com/creativecommons/cc-legal-tools -data
337
348
338
349
339
350
### Import Process
340
351
341
352
This process will read the HTML files from the specified directory, populate
342
353
`LegalCode` and `License` models, and create `.po` files in
343
- [creativecommons/cc-licenses -data][repodata].
354
+ [creativecommons/cc-legal-tools -data][repodata].
344
355
345
356
1. Ensure the [Data Repository](#data-repository), above, is in place
346
357
2. Ensure [Docker Compose Setup](#docker-compose-setup), above, is complete
@@ -353,11 +364,12 @@ This process will read the HTML files from the specified directory, populate
353
364
docker-compose exec app ./manage.py load_html_files
354
365
```
355
366
5. Optionally (and only as appropriate):
356
- 1. commit `.po` file changes in [creativecommons/cc-licenses-data][repodata]
367
+ 1. commit `.po` file changes in
368
+ [creativecommons/cc-legal-tools-data][repodata]
357
369
2. [Translation Update Process](#translation-update-process), below
358
370
3. [Generate Static Files](#generate-static-files), below
359
371
360
- [repodata]:https://github.com/creativecommons/cc-licenses -data
372
+ [repodata]:https://github.com/creativecommons/cc-legal-tools -data
361
373
362
374
363
375
### Import Dependency Documentation
@@ -378,11 +390,11 @@ there with access to these translations. Then follow the [Authentication -
378
390
Transifex API v3][transauth]: to get an API token, and set
379
391
`TRANSIFEX["API_TOKEN"]` in your environment with its value.
380
392
381
- The [creativecommons/cc-licenses -data][repodata] repository must be cloned
382
- next to this `cc-licenses ` repository. (It can be elsewhere, then you need to
383
- set `DATA_REPOSITORY_DIR` to its location.) Be sure to clone using a URL that
384
- starts with `git@github...` and not `https://github...`, or you won't be able
385
- to push to it. Also see [Data Repository](#data-repository), above.
393
+ The [creativecommons/cc-legal-tools -data][repodata] repository must be cloned
394
+ next to this `cc-legal-tools-app ` repository. (It can be elsewhere, then you need
395
+ to set `DATA_REPOSITORY_DIR` to its location.) Be sure to clone using a URL
396
+ that starts with `git@github...` and not `https://github...`, or you won't be
397
+ able to push to it. Also see [Data Repository](#data-repository), above.
386
398
387
399
In production, the `check_for_translation_updates` management command should be
388
400
run hourly. See [Check for Translation
@@ -398,14 +410,14 @@ Documentation:
398
410
- [Translation | Django documentation | Django][djangotranslation]
399
411
400
412
[babel]: http://babel.pocoo.org/en/latest/index.html
401
- [repodata]:https://github.com/creativecommons/cc-licenses -data
413
+ [repodata]:https://github.com/creativecommons/cc-legal-tools -data
402
414
[transauth]: https://transifex.github.io/openapi/index.html#section/Authentication
403
415
404
416
405
417
### How the license translation is implemented
406
418
407
419
Django Translation uses two sets of Gettext Files in the
408
- [creativecommons/cc-licenses -data][repodata] repository (the [Data
420
+ [creativecommons/cc-legal-tools -data][repodata] repository (the [Data
409
421
Repository](#data-repository), above). See that repository for detailed
410
422
information and definitions.
411
423
@@ -420,7 +432,7 @@ Documentation:
420
432
[api30intro]: https://docs.transifex.com/api-3-0/introduction-to-api-3-0
421
433
[apisdk]: https://github.com/transifex/transifex-python/tree/devel/transifex/api
422
434
[djangotranslation]: https://docs.djangoproject.com/en/3.2/topics/i18n/translation/
423
- [repodata]: https://github.com/creativecommons/cc-licenses -data
435
+ [repodata]: https://github.com/creativecommons/cc-legal-tools -data
424
436
425
437
426
438
### Check for Translation Updates
@@ -432,7 +444,7 @@ translation files in Transifex have newer last modification times than we know
432
444
about. It performs the following process (which can also be done manually:
433
445
434
446
1. Ensure the [Data Repository](#data-repository), above, is in place
435
- 2. Within the [creativecommons/cc-licenses -data][repodata] (the [Data
447
+ 2. Within the [creativecommons/cc-legal-tools -data][repodata] (the [Data
436
448
Repository](#data-repository)):
437
449
1. Checkout or create the appropriate branch.
438
450
- For example, if a French translation file for BY 4.0 has changed, the
@@ -442,12 +454,12 @@ about. It performs the following process (which can also be done manually:
442
454
- *This is important and easy to forget,* but without it, Django will
443
455
keep using the old translations
444
456
4. Commit that change and push it upstream.
445
- 3. Within this `cc-licenses ` repository:
457
+ 3. Within this `cc-legal-tools-app ` repository:
446
458
1. For each branch that has been updated, [Generate Static
447
459
Files](#generate-static-files) (below). Use the options to update git and
448
460
push the changes.
449
461
450
- [repodata]:https://github.com/creativecommons/cc-licenses -data
462
+ [repodata]:https://github.com/creativecommons/cc-legal-tools -data
451
463
452
464
453
465
### Check for Translation Updates Dependency Documentation
@@ -475,15 +487,15 @@ changed.
475
487
## Generate Static Files
476
488
477
489
Generating static files updates the static files in the `doc` directory of the
478
- [creativecommons/cc-licenses -data][repodata] repository (the [Data
490
+ [creativecommons/cc-legal-tools -data][repodata] repository (the [Data
479
491
Repository](#data-repository), above).
480
492
481
493
482
494
### Static Files Process
483
495
484
- This process will write the HTML files in the cc-licenses- data clone directory
485
- under `docs/`. It will not commit the changes (`--nogit`) and will not push any
486
- commits (`--nopush` is implied by `--nogit`).
496
+ This process will write the HTML files in the cc-legal-tools- data clone
497
+ directory under `docs/`. It will not commit the changes (`--nogit`) and will
498
+ not push any commits (`--nopush` is implied by `--nogit`).
487
499
488
500
1. Ensure the [Data Repository](#data-repository), above, is in place
489
501
2. Ensure [Docker Compose Setup](#docker-compose-setup), above, is complete
@@ -496,11 +508,11 @@ commits (`--nopush` is implied by `--nogit`).
496
508
### Publishing changes to git repo
497
509
498
510
When the site is deployed, to enable pushing and pulling the licenses data repo
499
- with GitHub, create an ssh deploy key for the cc-licenses- data repo with write
500
- permissions, and put the private key file (not password protected) somewhere
501
- safe (owned by `www-data` if on a server), and readable only by its owner
502
- (0o400). Then in settings, make `TRANSLATION_REPOSITORY_DEPLOY_KEY` be the full
503
- path to that deploy key file.
511
+ with GitHub, create an ssh deploy key for the cc-legal-tools- data repo with
512
+ write permissions, and put the private key file (not password protected)
513
+ somewhere safe (owned by `www-data` if on a server), and readable only by its
514
+ owner (0o400). Then in settings, make `TRANSLATION_REPOSITORY_DEPLOY_KEY` be
515
+ the full path to that deploy key file.
504
516
505
517
506
518
### Publishing Dependency Documentation
0 commit comments