Skip to content

Commit 6a32831

Browse files
committed
repository renames and application renames. includes database migration reset
1 parent 4c29161 commit 6a32831

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+283
-644
lines changed

README.md

+63-51
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
1-
# Creative Commons Licenses
1+
# cc-legal-tools-app-app
22

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.
38

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
515

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
819

920

1021
## Not the live site
@@ -14,8 +25,8 @@ Though if it's deployed on a public server it could do that, performance would
1425
probably not be acceptable.
1526

1627
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
1930
down.
2031

2132
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).
4152

4253
### Data Repository
4354

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:
4657
```
4758
PARENT_DIR
48-
├── cc-licenses
49-
└── cc-licenses-data
59+
├── cc-legal-tools-app-app
60+
└── cc-legal-tools-data
5061
```
5162

5263
If it is not cloned into the default location, the Django
5364
`DATA_REPOSITORY_DIR` django configuration setting, or the
5465
`DATA_REPOSITORY_DIR` environment variable can be used to configure its
5566
location.
5667

57-
[repodata]:https://github.com/creativecommons/cc-licenses-data
68+
[repodata]:https://github.com/creativecommons/cc-legal-tools-data
5869

5970

6071
### Docker Compose Setup
@@ -68,7 +79,7 @@ Use the following instructions to start the project with Docker compose.
6879
Compose | Docker Documentation][installcompose])
6980
3. Create Django local settings file
7081
```
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
7283
```
7384
4. Build the containers
7485
```
@@ -97,11 +108,11 @@ The commands above will create 3 docker containers:
97108
long as the development server is running.
98109
2. **db**: PostgreSQL database backend for this Django application
99110
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.
101112
102113
[installdocker]: https://docs.docker.com/engine/install/
103114
[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
105116
106117
107118
### Manual Setup
@@ -137,7 +148,7 @@ The commands above will create 3 docker containers:
137148
2. Configure Django and PostgreSQL
138149
1. Create Django local settings file
139150
```
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
141152
```
142153
2. Start PostgrSQL server
143154
- 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:
155166
3. Create project database
156167
- Linux:
157168
```
158-
sudo createdb -E UTF-8 cc_licenses
169+
sudo createdb -E UTF-8 cc_legal_tools
159170
```
160171
- macOS:
161172
```
162-
createdb -E UTF-8 cc_licenses
173+
createdb -E UTF-8 cc_legal_tools
163174
```
164175
4. Load database schema
165176
```
@@ -214,7 +225,7 @@ Best run before every commit:
214225
215226
Esoteric and dangerous:
216227
- `./dev/concatenatemessages.sh` - Concatenate legacy ccEngine translations
217-
into cc-licenses
228+
into cc-legal-tools-app
218229
- rarely used (only after source strings are updated)
219230
- `./dev/resetdb.sh` - Reset Django application database data (!!DANGER!!)
220231
- 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.
249260
250261
## Data
251262
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.
255266
256267
The metadata can be downloaded by visiting URL path:
257268
`127.0.0.1:8000`[`/licenses/metadata.yaml`][metadata]
258269
259270
[metadata]: http://127.0.0.1:8000/licenses/metadata.yaml
260271
261272
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):
263274
1. `LegalCode`
264275
2. `Licenses`
265276
@@ -269,12 +280,12 @@ prohibitions; a `version` (ex. `4.0`, `3.0)`, and an optional `jurisdiction`
269280
for ports. So we might refer to the license by it's **identifier** "BY 3.0 AM"
270281
which would be the 3.0 version of the BY license terms as ported to the Armenia
271282
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
273284
files, etc.)][namespace].
274285
275286
There are three places legal code text could be:
276287
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
278289
full translation support):
279290
- 4.0 Licenses
280291
- CC0
@@ -293,8 +304,8 @@ Documentation:
293304
- [Models | Django documentation | Django][djangomodels]
294305
- [Templates | Django documentation | Django][djangotemplates]
295306
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
298309
[cctransifex]: https://www.transifex.com/creativecommons/public/
299310
[djangomodels]: https://docs.djangoproject.com/en/3.2/topics/db/models/
300311
[djangotemplates]: https://docs.djangoproject.com/en/3.2/topics/templates/
@@ -310,7 +321,7 @@ need to be repeated after that.
310321
311322
The implementation is the Django management command `load_html_files`, which
312323
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
314325
database records and translation files.
315326
316327
`load_html_files` uses [BeautifulSoup4][bs4docs] to parse the legacy HTML legal
@@ -333,14 +344,14 @@ code:
333344
`LegalCode` model
334345
335346
[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
337348
338349
339350
### Import Process
340351
341352
This process will read the HTML files from the specified directory, populate
342353
`LegalCode` and `License` models, and create `.po` files in
343-
[creativecommons/cc-licenses-data][repodata].
354+
[creativecommons/cc-legal-tools-data][repodata].
344355
345356
1. Ensure the [Data Repository](#data-repository), above, is in place
346357
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
353364
docker-compose exec app ./manage.py load_html_files
354365
```
355366
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]
357369
2. [Translation Update Process](#translation-update-process), below
358370
3. [Generate Static Files](#generate-static-files), below
359371
360-
[repodata]:https://github.com/creativecommons/cc-licenses-data
372+
[repodata]:https://github.com/creativecommons/cc-legal-tools-data
361373
362374
363375
### Import Dependency Documentation
@@ -378,11 +390,11 @@ there with access to these translations. Then follow the [Authentication -
378390
Transifex API v3][transauth]: to get an API token, and set
379391
`TRANSIFEX["API_TOKEN"]` in your environment with its value.
380392
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.
386398
387399
In production, the `check_for_translation_updates` management command should be
388400
run hourly. See [Check for Translation
@@ -398,14 +410,14 @@ Documentation:
398410
- [Translation | Django documentation | Django][djangotranslation]
399411
400412
[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
402414
[transauth]: https://transifex.github.io/openapi/index.html#section/Authentication
403415
404416
405417
### How the license translation is implemented
406418
407419
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
409421
Repository](#data-repository), above). See that repository for detailed
410422
information and definitions.
411423
@@ -420,7 +432,7 @@ Documentation:
420432
[api30intro]: https://docs.transifex.com/api-3-0/introduction-to-api-3-0
421433
[apisdk]: https://github.com/transifex/transifex-python/tree/devel/transifex/api
422434
[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
424436
425437
426438
### Check for Translation Updates
@@ -432,7 +444,7 @@ translation files in Transifex have newer last modification times than we know
432444
about. It performs the following process (which can also be done manually:
433445
434446
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
436448
Repository](#data-repository)):
437449
1. Checkout or create the appropriate branch.
438450
- 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:
442454
- *This is important and easy to forget,* but without it, Django will
443455
keep using the old translations
444456
4. Commit that change and push it upstream.
445-
3. Within this `cc-licenses` repository:
457+
3. Within this `cc-legal-tools-app` repository:
446458
1. For each branch that has been updated, [Generate Static
447459
Files](#generate-static-files) (below). Use the options to update git and
448460
push the changes.
449461
450-
[repodata]:https://github.com/creativecommons/cc-licenses-data
462+
[repodata]:https://github.com/creativecommons/cc-legal-tools-data
451463
452464
453465
### Check for Translation Updates Dependency Documentation
@@ -475,15 +487,15 @@ changed.
475487
## Generate Static Files
476488
477489
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
479491
Repository](#data-repository), above).
480492
481493
482494
### Static Files Process
483495
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`).
487499
488500
1. Ensure the [Data Repository](#data-repository), above, is in place
489501
2. Ensure [Docker Compose Setup](#docker-compose-setup), above, is complete
@@ -496,11 +508,11 @@ commits (`--nopush` is implied by `--nogit`).
496508
### Publishing changes to git repo
497509
498510
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.
504516
505517
506518
### Publishing Dependency Documentation
File renamed without changes.

cc_licenses/settings/base.py renamed to cc_legal_tools/settings/base.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Django settings for cc_licenses project.
2+
Django settings for cc_legal_tools project.
33
"""
44
# Standard library
55
import os
@@ -8,9 +8,9 @@
88
import colorlog # noqa: F401
99
from django.conf.locale import LANG_INFO
1010

11-
APP_NAME = "licenses"
11+
APP_NAME = "legal_tools"
1212
APP_LABEL = APP_NAME
13-
APP_VERBOSE_NAME = APP_NAME.title()
13+
APP_VERBOSE_NAME = APP_NAME.replace("_", " ").title()
1414

1515
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
1616
# SETTINGS_DIR is where this settings file is
@@ -39,7 +39,7 @@
3939
"django.contrib.sessions",
4040
"django.contrib.messages",
4141
"django.contrib.staticfiles",
42-
"licenses",
42+
"legal_tools",
4343
"i18n",
4444
]
4545

@@ -53,7 +53,7 @@
5353
"django.middleware.clickjacking.XFrameOptionsMiddleware",
5454
]
5555

56-
ROOT_URLCONF = "cc_licenses.urls"
56+
ROOT_URLCONF = "cc_legal_tools.urls"
5757

5858
TEMPLATES = [
5959
{
@@ -74,7 +74,7 @@
7474
},
7575
]
7676

77-
WSGI_APPLICATION = "cc_licenses.wsgi.application"
77+
WSGI_APPLICATION = "cc_legal_tools.wsgi.application"
7878

7979

8080
# Database
@@ -83,7 +83,7 @@
8383
DATABASES = {
8484
"default": {
8585
"ENGINE": "django.db.backends.postgresql_psycopg2",
86-
"NAME": "cc_licenses",
86+
"NAME": "cc_legal_tools",
8787
}
8888
}
8989

@@ -147,7 +147,7 @@
147147
"level": "DEBUG",
148148
"propagate": False,
149149
},
150-
"licenses.management.commands": {
150+
"legal_tools.management.commands": {
151151
"handlers": ["handle_mgmt"],
152152
"level": "DEBUG",
153153
"propagate": False,
@@ -177,7 +177,7 @@
177177
os.path.realpath(
178178
os.getenv(
179179
"DATA_REPOSITORY_DIR",
180-
os.path.join(PROJECT_ROOT, "..", "cc-licenses-data"),
180+
os.path.join(PROJECT_ROOT, "..", "cc-legal-tools-data"),
181181
)
182182
)
183183
)

0 commit comments

Comments
 (0)