find and replace fixes, will introduce errors

This commit is contained in:
Ariel Rin
2023-10-27 16:37:53 +10:00
parent b9d128259e
commit ffb526ab0c
52 changed files with 615 additions and 589 deletions

View File

@@ -4,13 +4,13 @@ The documentation for Alliance Auth uses [Sphinx](http://www.sphinx-doc.org/) to
to specific branches is made (master, primarily), the repository is automatically pulled, docs built and deployed on
[readthedocs.org](https://readthedocs.org/).
Documentation was migrated from the GitHub wiki pages and into the repository to allow documentation changes to be
included with pull requests. This means that documentation can be guaranteed to be updated when a pull request is
accepted rather than hoping documentation is updated afterwards or relying on maintainers to do the work. It also
allows for documentation to be maintained at different versions more easily.
## Building Documentation
If you're developing new documentation, its likely you'll want or need to test build it before committing to your
branch. To achieve this you can use Sphinx to build the documentation locally as it appears on Read the Docs.
@@ -24,15 +24,16 @@ build in the `/docs/_build/` directory.
Occasionally you may need to fully rebuild the documents by running `make clean` first, usually when you add or
rearrange toctrees.
## Documentation Format
CommonMark Markdown is the current preferred format, via [recommonmark](https://github.com/rtfd/recommonmark).
reStructuredText is supported if required, or you can execute snippets of reST inside Markdown by using a code block:
CommonMark-plus Markdown is the current preferred format, via [MyST-Parser](https://github.com/executablebooks/MyST-Parser).
reStructuredText is supported if required, or you can execute snippets of MyST inside Markdown by using a code block:
```eval_rst
reStructuredText here
```
````md
```{eval-rst}
reStructuredText here
```
````
Markdown is used elsewhere on Github so it provides the most portability of documentation from Issues and Pull Requests
as well as providing an easier initial migration path from the Github wiki.

View File

@@ -2,10 +2,9 @@
This section contains important information on how to develop Alliance Auth itself.
```eval_rst
.. toctree::
:maxdepth: 1
```{toctree}
:maxdepth: 1
documentation
code-style
documentation
code-style
```

View File

@@ -2,12 +2,11 @@
This section describes how to extend **Alliance Auth** with custom apps and services.
```eval_rst
.. toctree::
:maxdepth: 1
```{toctree}
:maxdepth: 1
integrating-services
menu-hooks
url-hooks
logging
integrating-services
menu-hooks
url-hooks
logging
```

View File

@@ -46,7 +46,7 @@ In order to integrate with Alliance Auth service modules must provide a `service
This would register the ExampleService class which would need to be a subclass of `services.hooks.ServiceHook`.
```eval_rst
```{eval-rst}
.. important::
The hook **MUST** be registered in ``yourservice.auth_hooks`` along with any other hooks you are registering for Alliance Auth.
```

View File

@@ -40,7 +40,7 @@ A list of views or namespaces the link should be highlighted on. See [django-nav
This is a great feature to signal the user, that he has some open issues to take care of within an app. For example Auth uses this feature to show the specific number of open group request to the current user.
```eval_rst
```{eval-rst}
.. hint::
Here is how to stay consistent with the Auth design philosophy for using this feature:
1. Use it to display open items that the current user can close by himself only. Do not use it for items, that the user has no control over.

View File

@@ -18,8 +18,7 @@ In addition is it possible to make views public. Normally, all views are automat
An app can opt-out of this feature by adding a list of views to be excluded when registering the URLs. See the `excluded_views` parameter for details.
```eval_rst
.. note::
:::{note}
Note that for a public view to work, administrators need to also explicitly allow apps to have public views in their AA installation, by adding the apps label to ``APPS_WITH_PUBLIC_VIEWS`` setting.
```
@@ -59,7 +58,7 @@ When this app is included in the project's `settings.INSTALLED_APPS` users would
## API
```eval_rst
```{eval-rst}
.. autoclass:: allianceauth.services.hooks.UrlHook
:members:
```

View File

@@ -6,7 +6,7 @@ The main benefit of this setup is that it runs all services and code in the nati
In addition all tools described in this guide are open source or free software.
```eval_rst
```{eval-rst}
.. hint::
This guide is meant for development purposes only and not for installing AA in a production environment. For production installation please see chapter **Installation**.
```
@@ -25,8 +25,7 @@ The development environment consists of the following components:
We will use the build-in Django development web server, so we don't need to setup a WSGI server or a web server.
```eval_rst
.. note::
:::{note}
This setup works with both WSL 1 and WSL 2. However, due to the significantly better performance we recommend WSL 2.
```
@@ -58,13 +57,13 @@ The only requirement is a PC with Windows 10 and Internet connection in order to
Open a WSL bash and update all software packets:
```bash
```shell
sudo apt update && sudo apt upgrade -y
```
### Install Tools
```bash
```shell
sudo apt-get install build-essential
sudo apt-get install gettext
```
@@ -73,13 +72,12 @@ sudo apt-get install gettext
Next we need to install Python and related development tools.
```eval_rst
```{eval-rst}
.. hint::
To check your system's Python 3 version you can enter: ``python3 --version``
```
```eval_rst
.. note::
:::{note}
Should your Ubuntu come with a newer version of Python we recommend to still setup your dev environment with the oldest Python 3 version currently supported by AA (e.g Python 3.8 at this time of writing) to ensure your apps are compatible with all current AA installations
You an check out this `page <https://askubuntu.com/questions/682869/how-do-i-install-a-different-python-version-using-apt-get/1195153>`_ on how to install additional Python versions on Ubuntu.
@@ -90,19 +88,19 @@ Next we need to install Python and related development tools.
Use the following command to install Python 3 with all required libraries with the default version:
```bash
```shell
sudo apt-get install python3 python3-dev python3-venv python3-setuptools python3-pip python-pip
```
### Install redis and other tools
```bash
```shell
sudo apt-get install unzip git redis-server curl libssl-dev libbz2-dev libffi-dev pkg-config
```
Start redis
```bash
```shell
sudo redis-server --daemonize yes
```
@@ -110,30 +108,29 @@ sudo redis-server --daemonize yes
Install MySQL and required libraries with the following command:
```bash
```shell
sudo apt-get install mysql-server mysql-client libmysqlclient-dev
```
```eval_rst
.. note::
:::{note}
We chose to use MySQL instead of MariaDB, because the standard version of MariaDB that comes with this Ubuntu distribution will not work with AA.
```
We need to apply a permission fix to mysql or you will get a warning with every startup:
```bash
```shell
sudo usermod -d /var/lib/mysql/ mysql
```
Start the mysql server
```bash
```shell
sudo service mysql start
```
Create database and user for AA
```bash
```shell
sudo mysql -u root
```
@@ -147,12 +144,11 @@ exit;
Add timezone info to mysql:
```bash
```shell
sudo mysql_tzinfo_to_sql /usr/share/zoneinfo | sudo mysql -u root mysql
```
```eval_rst
.. note::
:::{note}
If your WSL does not have an init.d service, it will not automatically start your services such as MySQL and Redis when you boot your Windows machine and you have to manually start them. For convenience we recommend putting these commands in a bash script. Here is an example:
::
@@ -183,7 +179,7 @@ Following this approach you can also setup additional AA projects, e.g. aa-dev-2
Create the root folder `aa-dev`.
```eval_rst
```{eval-rst}
.. hint::
The folders `venv` and `myauth` will be created automatically in later steps. Please do not create them manually as this would lead to errors.
```
@@ -192,19 +188,19 @@ Create the root folder `aa-dev`.
Create the virtual environment. Run this in your aa-dev folder:
```bash
```shell
python3 -m venv venv
```
And activate your venv:
```bash
```shell
source venv/bin/activate
```
### Install and update basic Python packages
```bash
```shell
pip install -U pip setuptools wheel
```
@@ -212,19 +208,19 @@ pip install -U pip setuptools wheel
### Install and create AA instance
```bash
```shell
pip install allianceauth
```
Now we are ready to setup our AA instance. Make sure to run this command in your aa-dev folder:
```bash
```shell
allianceauth start myauth
```
Next we will setup our VSC project for aa-dev by starting it directly from the WSL bash:
```bash
```shell
code .
```
@@ -244,7 +240,7 @@ For the Eve Online related setup you need to create a SSO app on the developer s
Open your local Django settings with VSC. The file is under `myauth/myauth/settings/local.py`
```eval_rst
```{eval-rst}
.. hint::
There are two Django settings files: ``base.py`` and ``local.py``. The base settings file is controlled by the AA project and may change at any time. It is therefore recommended to only change the local settings file.
```
@@ -293,14 +289,14 @@ REGISTRATION_VERIFY_EMAIL = False
Before we can start AA we need to run migrations:
```bash
```shell
cd myauth
python manage.py migrate
```
We also need to create a superuser for our AA installation:
```bash
```shell
python manage.py createsuperuser
```
@@ -310,19 +306,18 @@ python manage.py createsuperuser
We are now ready to run out AA instance with the following command:
```bash
```shell
python manage.py runserver
```
Once running you can access your auth site on the browser under `http://localhost:8000`. Or the admin site under `http://localhost:8000/admin`
```eval_rst
```{eval-rst}
.. hint::
You can start your AA server directly from a terminal window in VSC or with a VSC debug config (see chapter about debugging for details).
```
```eval_rst
.. note::
:::{note}
**Debug vs. Non-Debug mode**
Usually it is best to run your dev AA instance in debug mode, so you get all the detailed error messages that helps a lot for finding errors. But there might be cases where you want to test features that do not exist in debug mode (e.g. error pages) or just want to see how your app behaves in non-debug / production mode.
@@ -335,7 +330,7 @@ In addition you can start a celery worker instance for myauth. For development p
This can be done from the command line with the following command in the myauth folder (where manage.py is located):
```bash
```shell
celery -A myauth worker -l info -P solo
```
@@ -499,7 +494,7 @@ Open a WSL bash and navigate to the aa-dev folder. Make sure you have activate y
Run these commands:
```bash
```shell
git clone https://gitlab.com/ErikKalkoken/allianceauth-example-plugin.git
pip install -e allianceauth-example-plugin
```
@@ -508,7 +503,7 @@ Add `'example'` to INSTALLED_APPS in your `local.py` settings.
Run migrations and restart your AA server, e.g.:
```bash
```shell
cd myauth
python manage.py migrate
```

View File

@@ -2,9 +2,8 @@
Here you find guides on how to setup your development environment for AA.
```eval_rst
.. toctree::
:maxdepth: 1
```{toctree}
:maxdepth: 1
aa-dev-setup-wsl-vsc-v2
aa-dev-setup-wsl-vsc-v2
```

View File

@@ -2,12 +2,11 @@
**Alliance Auth** is designed to be extended easily. Learn how to develop your own apps and services for AA or to develop for AA core in the development chapter.
```eval_rst
.. toctree::
:maxdepth: 1
```{toctree}
:maxdepth: 1
custom/index
aa_core/index
dev_setup/index
tech_docu/index
custom/index
aa_core/index
dev_setup/index
tech_docu/index
```

View File

@@ -2,16 +2,15 @@
To reduce redundancy and help speed up development we encourage developers to utilize the following packages when developing apps for Alliance Auth.
```eval_rst
.. toctree::
:maxdepth: 1
```{toctree}
:maxdepth: 1
discord_client
discord_service
esi
evelinks
eveonline
notifications
testutils
utils
discord_client
discord_service
esi
evelinks
eveonline
notifications
testutils
utils
```

View File

@@ -14,8 +14,7 @@ Alliance Auth is an online web application and as such the user expects fast and
As a rule of thumb we therefore recommend to use celery tasks for every process that can take longer than 1 sec to complete (also think about how long your process might take with large amounts of data).
```eval_rst
.. note::
:::{note}
Another solution for dealing with long response time in particular when loading pages is to load parts of a page asynchronously, for example with AJAX.
```
@@ -106,7 +105,7 @@ In this example we fist add 10 example tasks that need to run one after the othe
The list of task signatures is then converted to a chain and started asynchronously.
```eval_rst
```{eval-rst}
.. hint::
In our example we use ``si()``, which is a shortcut for "immutable signatures" and prevents us from having to deal with result sharing between tasks.
@@ -137,7 +136,7 @@ CELERYBEAT_SCHEDULE['structures_update_all_structures'] = {
In Alliance Auth we have defined task priorities from 0 - 9 as follows:
```eval_rst
```{eval-rst}
====== ========= ===========
Number Priority Description
====== ========= ===========
@@ -150,14 +149,14 @@ In Alliance Auth we have defined task priorities from 0 - 9 as follows:
====== ========= ===========
```
```eval_rst
```{eval-rst}
.. warning::
Please make sure to use task priorities with care and especially do not use higher priorities without a good reason. All apps including Alliance Auth share the same task queues, so using higher task priorities excessively can potentially prevent more important tasks (of other apps) from completing on time.
You also want to make sure to run use lower priorities if you have a large amount of tasks or long running tasks, which are not super urgent. (e.g. the regular update of all Eve characters from ESI runs with priority 7)
```
```eval_rst
```{eval-rst}
.. hint::
If no priority is specified all tasks will be started with the default priority, which is 5.
```
@@ -170,7 +169,7 @@ Example for starting a task with priority 3:
example.apply_async(priority=3)
```
```eval_rst
```{eval-rst}
.. hint::
For defining a priority to tasks you can not use the convenient shortcut ``delay()``, but instead need to start a task with ``apply_async()``, which also requires you to pass parameters to your task function differently. Please check out the `official docs <https://docs.celeryproject.org/en/stable/reference/celery.app.task.html#celery.app.task.Task.apply_async>`_ for details.
```

View File

@@ -2,12 +2,11 @@
In this section you find topics useful for app developers.
```eval_rst
.. toctree::
:maxdepth: 1
```{toctree}
:maxdepth: 1
api/index
celery
core_models
templatetags
api/index
celery
core_models
templatetags
```