One of the big advantages of Alliance Auth (AA) is that can be easily extended with custom apps. So with a little Python and Django know-how you can quickly add your own apps to AA's web portal and make use of AA's permission system.
To help you get up to speed quickly here is how you can setup a dev environment on Windows.
This guide is for Windows, because some devs will find it more comfortable to develop in a Windows environment. However, AA does not officially support Windows, so this approach comes with some limitations. Please also see our other guide based on WSL for Winddows 10, which does not hav any of these limitations.
The current main limitations is that Celery is not available, so you can not build apps that need to run asynchronous tasks. But for less complex apps this approach will work just fine.
To keep things simple this installation will use the default SQLite instead of connecting to a real DBMS like MySQL. This will impact performance, but should still be sufficient for most development environments.
Important: Due to the many differences between Windows and Linux environments its strongly recommended to test any new apps in a Linux test AA before running them on your production AA.
You need the following software installed on your windows machine:
- Windows 10
- Python 3.5
- ngrok
- Visual Studio Code (or any other editor / dev tools for Python3)
Important: Most Linux systems won't have the current Python 3.7 running, because it is not include in current official Linux distributions (e.g. Ubuntu 16.04 has Python 3.5, Ubuntu 18.03 has Python 3.6). So to ensure compatibility of your AA apps its best to use Python 3.4 or Python 3.5. We wil be using 3.5.
First we need to setup ngrok. ngrok will create a secure VPN tunnel to your local web server applications on the Internet to access it. This is needed so that we can use Eve Online's SSO to log into our AA server.
Our AA server will running with Django's dev web server on port 8000, so we need a ngrok URL that connects to localhost:8000.
Open your local ngrok config file (~/.ngrok2/ngrok.yml
) and add the tunnel.
Here is example file:
authtoken: YOUR-TOKEN
json_resolver_url: ""
dns_resolver_ips: []
tunnels:
python-dev:
proto: http
addr: 8000
Restart ngrok so the changes take effect. You want to make sure ngrok is running in its own shell window.
Open your ngrok management page by going to http://localhost:4040/status. You should see two entries for python-dev
.
Our AA server will be running on the https URL: e.g. https://12345678.ngrok.io.
The "12345678" in the URL needs to be replaced with the current ngrok address for your https tunnel to python-dev. We wil be using 12345678 in this doc as example.
Go to the Eve developer site and create an Eve app for your installation or re-use an existing app for localhost.
Update the redirect URL to: https://12345678.ngrok.io/sso/callback.
Add at least the publicData
scope. You can add more scopes later as needed for your app.
Confirm your changes.
We will call our windows installation "winauth", but you can give it any name your like.
Open a shell and navigate to where you want to put your AA installation. (e.g. in your Python folder). Now lets create its root folder:
mkdir winauth
Next we will create a virtual python environment for winauth.
First we need to install venv. Then we will create the virtual environnement in the root folder with Python 3.5 and activate it.
pip install venv
py -3.5 -m venv venv
venv\Scripts\Activate.ps1
Make sure you always have your virtual environment activate while making changes (e.g. installing new packages). You also want to your Python development suite use this virtual environment (e.g. Visual Studio Code will detect it automatically), so that it has the correct Python version and finds all packages.
Now we will install AA from PyPI. Note that are we pre-installing mysqlclient as binary to avoid pip having to recompile it.
python -m pip install --upgrade pip
pip install --only-binary :all: mysqlclient
pip install allianceauth
If you run into any issues during installation it might be related to missing build tools on your system. (this can happen with any PyPI package that includes c/c++ sources that need to be recompiled.) Check out this answer on Stack Overflow on how to fix it.
Finally we are ready to create our AA instance:
allianceauth start winauth
Next we need to do the initial setup of your local settings. Open winauth\winauth\settings\local.py
in an editor and make the following changes:
- Set DEBUG to True to enable Django debug logging
- Comment out DATABASES with all its lines to use sqlite3 as DB.
- Enter EVE SSO ID, secret and callback URL from your EVE SSO app
- Set REGISTRATION_VERIFY_EMAIL to False by un-commenting the line
Navigate into the winauth project folder (e.g. winauth\winauth). It's the folder that has the manage.py
file in it.
First check to ensure your settings are valid.
python manage.py check
Django needs to install models to the database before it can start.
python manage.py migrate
Before using your auth site it is essential to create a superuser account. This account will have all permissions in Alliance Auth. It's OK to use this as your personal auth account.
python manage.py createsuperuser
Now we a ready run the AA server for the first time. We will be running AA with the build-in Django development server.
Navigate into the winauth project folder and run the following command:
python manage.py runserver
The first thing should be setting up your admin account and link to your main for convenience.
Login to AA's admin page with your browser under: https://12345678.ngrok.io/admin
Next you can now also add your main EVE account as main for the admin account.
- Switch to the dashboard by clicking on "View site" on the admin page
- Click on "Add Character" and add your Eve char
- Click on "Change Main" to make this char your main
That's it. If you have any feedback or issues please let the author know.