|
1 | | -# markapi |
| 1 | +# MarkAPI |
| 2 | + |
| 3 | +MarkAPI is a project designed to tag, validate, and convert XML documents in the SciELO publishing context. It offers tools for: |
| 4 | + |
| 5 | +- Tagging XML structure and content |
| 6 | +- Validating XML against defined schemas, business rules and content |
| 7 | +- Converting XML to HTML, DOCX, and PDF |
| 8 | + |
| 9 | +[](https://github.com/ambv/black) |
| 10 | + |
| 11 | +License: GPLv3 |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +## Development Environment |
| 16 | + |
| 17 | +You can use Docker directly or via `make`. To see available commands: |
| 18 | + |
| 19 | +```bash |
| 20 | +make help |
| 21 | +``` |
| 22 | + |
| 23 | +Example output: |
| 24 | + |
| 25 | +```bash |
| 26 | +Usage: make [target] [argument] ... |
| 27 | + |
| 28 | +Argument: |
| 29 | + compose = {compose_file_name} |
| 30 | + |
| 31 | +Targets: |
| 32 | + help Show this help |
| 33 | + app_version Show app version |
| 34 | + vcs_ref Show last commit ref |
| 35 | + build_date Show build date |
| 36 | + build Build app using $(COMPOSE_FILE_DEV) |
| 37 | + up Start app using $(COMPOSE_FILE_DEV) |
| 38 | + logs Show logs using $(COMPOSE_FILE_DEV) |
| 39 | + stop Stop app using $(COMPOSE_FILE_DEV) |
| 40 | + ps Show containers using $(COMPOSE_FILE_DEV) |
| 41 | + rm Remove containers using $(COMPOSE_FILE_DEV) |
| 42 | + django_shell Open Django shell |
| 43 | + wagtail_sync Sync Wagtail page fields |
| 44 | + wagtail_update_translation_field Update Wagtail translation fields |
| 45 | + django_createsuperuser Create Django superuser |
| 46 | + django_bash Bash into Django container |
| 47 | + django_test Run Django tests |
| 48 | + django_fast Run fast Django tests |
| 49 | + django_makemigrations Make migrations |
| 50 | + django_migrate Apply migrations |
| 51 | + django_makemessages Run makemessages |
| 52 | + django_compilemessages Run compilemessages |
| 53 | + django_dump_auth Dump Django auth data |
| 54 | + django_load_auth Load Django auth data |
| 55 | + dump_data Dump database to .sql |
| 56 | + restore_data Restore database from .sql |
| 57 | +``` |
| 58 | + |
| 59 | +### Common Commands |
| 60 | + |
| 61 | +Build the development environment: |
| 62 | + |
| 63 | +```bash |
| 64 | +make build compose=local.yml |
| 65 | +# or simply |
| 66 | +make |
| 67 | +``` |
| 68 | + |
| 69 | +Start the project: |
| 70 | + |
| 71 | +```bash |
| 72 | +make up |
| 73 | +``` |
| 74 | + |
| 75 | +Stop the project: |
| 76 | + |
| 77 | +```bash |
| 78 | +make stop |
| 79 | +``` |
| 80 | + |
| 81 | +To use a custom `.yml` or environment, copy `.envs` and `compose` folders, then run: |
| 82 | + |
| 83 | +```bash |
| 84 | +make <target> compose=your_config.yml |
| 85 | +``` |
| 86 | + |
| 87 | +The stack uses two Docker Compose files: |
| 88 | + |
| 89 | +* `local.yml` (development) |
| 90 | +* `production.yml` (production) |
| 91 | + |
| 92 | +--- |
| 93 | + |
| 94 | +## Settings |
| 95 | + |
| 96 | +Refer to the [settings documentation](http://cookiecutter-django.readthedocs.io/en/latest/settings.html). |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | +## Usage Guide |
| 101 | + |
| 102 | +### User Setup |
| 103 | + |
| 104 | +* **Normal user:** Sign up via UI. Confirm email using the console output. |
| 105 | +* **Superuser:** Run: |
| 106 | + |
| 107 | +```bash |
| 108 | +python manage.py createsuperuser |
| 109 | +``` |
| 110 | + |
| 111 | +Use different browsers to test both user types simultaneously. |
| 112 | + |
| 113 | +--- |
| 114 | + |
| 115 | +### Type Checks |
| 116 | + |
| 117 | +```bash |
| 118 | +mypy core |
| 119 | +``` |
| 120 | + |
| 121 | +--- |
| 122 | + |
| 123 | +### Testing |
| 124 | + |
| 125 | +Run tests and generate coverage report: |
| 126 | + |
| 127 | +```bash |
| 128 | +coverage run -m pytest |
| 129 | +coverage html |
| 130 | +open htmlcov/index.html |
| 131 | +``` |
| 132 | + |
| 133 | +Or just: |
| 134 | + |
| 135 | +```bash |
| 136 | +pytest |
| 137 | +``` |
| 138 | + |
| 139 | +--- |
| 140 | + |
| 141 | +### Live Reload & Sass |
| 142 | + |
| 143 | +See: [Live reloading & SASS](https://cookiecutter-django.readthedocs.io/en/latest/developing-locally.html#sass-compilation-live-reloading) |
| 144 | + |
| 145 | +--- |
| 146 | + |
| 147 | +### Celery |
| 148 | + |
| 149 | +To start a worker: |
| 150 | + |
| 151 | +```bash |
| 152 | +cd core |
| 153 | +celery -A config.celery_app worker -l info |
| 154 | +``` |
| 155 | + |
| 156 | +Ensure you're in the correct directory (`core`) for Celery to work properly. |
| 157 | + |
| 158 | +--- |
| 159 | + |
| 160 | +### Email (MailHog) |
| 161 | + |
| 162 | +A local SMTP server with web UI is included. |
| 163 | + |
| 164 | +Access at: `http://127.0.0.1:8025` |
| 165 | + |
| 166 | +See [Docker deployment docs](http://cookiecutter-django.readthedocs.io/en/latest/deployment-with-docker.html) for details. |
| 167 | + |
| 168 | +--- |
| 169 | + |
| 170 | +### Sentry |
| 171 | + |
| 172 | +Sentry is pre-configured for logging. Set the DSN URL in production. |
| 173 | + |
| 174 | +Signup at: [https://sentry.io/signup/?code=cookiecutter](https://sentry.io/signup/?code=cookiecutter) |
| 175 | + |
| 176 | +--- |
| 177 | + |
| 178 | +## Deployment |
| 179 | + |
| 180 | +See full [Docker deployment guide](http://cookiecutter-django.readthedocs.io/en/latest/deployment-with-docker.html). |
0 commit comments