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

@@ -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
```