Skip to main content

Django interface to Opalstack python API

Project description

Django interface to Opalstack python API

What is (((Opalstack?

(((Opalstack.com is a developer friendly hosting company. It has a powerful API that enables full control over one’s hosting environment. A python wrapper is provided for the API.

Requirements

This app is tested on Django 5.1 and Python 3.12. It requires the aforementioned python API and the requests library. HTMX is injected for smooth interactions (JavaScript must be enabled in your browser).

Installation from PyPI

Activate your virtual environment and install with:

python -m pip install django-opalstack

In your Django project add:

INSTALLED_APPS = [
    # ...
    "django_opalstack",
]
# my_project/urls.py
urlpatterns = [
    # ...
    path("opal/", include("django_opalstack.urls", namespace="django_opalstack")),
]

Finally run the following management commands:

python manage.py migrate
python manage.py collectstatic

Templates

You also need a base.html template with following template blocks (a sample base.html is provided among package templates).

{% block content %}
{% endblock content %}
...
{% block extra-js %}
{% end block extra-js %}

Package comes with several templates in the django_opalstack/templates/ directory. All templates have very few styles (all inline). If you want to add your own styles, copy the templates in a new my_project/templates/django_opalstack/ directory and override them. You will have to set:

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [BASE_DIR / "my_project/templates"],
        # ...
    },
]

Usage

You will need an (((Opalstack.com account (there is a 14-day free trial). Once logged in, obtain a API token from https://my.opalstack.com/tokens/. Copy the token KEY, then run the local server and browse to http://128.1.1.0:8000/admin/django_opalstack/token/add/ and create a new Token pasting the previously copied KEY. Go to http://128.1.1.0:8000/opal/token/ and select the newly added token. At the moment the app is read only, you will have to create OS users, Applications and Sites directly on Opalstack.

Tests

Tests with unittest, 99% coverage. Tested for Django 5.1 and Python 3.12 versions.

Changelog

  • 0.1.0: First working version (read only)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_opalstack-0.1.0.tar.gz (47.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_opalstack-0.1.0-py3-none-any.whl (31.1 kB view details)

Uploaded Python 3

File details

Details for the file django_opalstack-0.1.0.tar.gz.

File metadata

  • Download URL: django_opalstack-0.1.0.tar.gz
  • Upload date:
  • Size: 47.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.10

File hashes

Hashes for django_opalstack-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6f9b98750de9a2b60c4a69e17f51b07c63f512b37c0a251c1ebfbe069ce0b97f
MD5 bdd8e4d52aebaa557275fd5d6fc16611
BLAKE2b-256 c3f0c36123cc979e72646e6659871c06b5b0bdc0bcb6675d178c528781db53c0

See more details on using hashes here.

File details

Details for the file django_opalstack-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_opalstack-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 175e18c3c7e6e8964516137c95b258c2d0d68415a671300cf6c6cfcc612fae0e
MD5 4c95e669c9f7058e0716ee13857a6a1e
BLAKE2b-256 5b992176207912b952ea715c4090d60f1c1f68577415fe8223234d0cacd0bbc6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page