Install a Django application into AWX

The question: Is it possible to add a custom Django application to the AWX web application ?

Theoretically this should be the case since the AWX web application also is a Django application. If I am not mistaken of course. Usually it’s just a matter of settings things in settings.py and urls.py.

The main reasons being performance and implementation simplicity; compared to a separate remote web application that is.

Is it possible ? If so, how best to proceed ?

thx !

It's certainly possible, but not officially supported.

Essentially you would just need to make sure your Django application
gets pip installed into the web container, and then modify the
settings.py INSTALLED_APPS such that the application is enabled.

There is hope then ! :slight_smile: But I’d like to keep the hacking to a strict minimum.

Do you know which settings.py this is ?

The only settings.py file I could find with INSTALLED_APPS is …/solo/tests/settings.py in the venv installed packages.

There is /etc/tower/settings.py. It kinda looks like a Django project settings file except there is no INSTALLED_APPS in there.

I think the prime candidate is /var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/settings/defaults.py. But that’s in venv too.

It would be /etc/tower/settings.py.

The reason why you're not seeing INSTALLED_APPS there is because AWX
also has a defaults file:
https://github.com/ansible/awx/blob/eaf3a28d57710127585f5cf0e2ec3a7b686f96fd/awx/settings/defaults.py#L258-L279

So far I think it works:

  • Install my package into the virtual environment /var/lib/awx/venv/awx.
  • Append INSTALLED_APPS = [“myapp”] + INSTALLED_APPS to /etc/tower/settings.py.
    The container seems to start properly. Only thing left now is a url pattern pointing to myapp. And kick off the migrations. Etc…

However, this is looking like hacking my way into the application. So I think it’s better not to consider this any longer and deal with a remote Django application instead over http/rest.

Anyway, I thank you all for feedback !