diff --git a/.gitignore b/.gitignore index 48d1125..a716121 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,4 @@ wheels/ # Project specifics .env *.sqlite3 -hub/media/ +media/ diff --git a/hub/hub/__init__.py b/hub/__init__.py similarity index 100% rename from hub/hub/__init__.py rename to hub/__init__.py diff --git a/hub/__main__.py b/hub/__main__.py new file mode 100644 index 0000000..b2d038c --- /dev/null +++ b/hub/__main__.py @@ -0,0 +1,13 @@ +import os +import sys + + +def main(): + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hub.settings") + from django.core.management import execute_from_command_line + + execute_from_command_line(sys.argv) + + +if __name__ == "__main__": + main() diff --git a/hub/hub/asgi.py b/hub/asgi.py similarity index 100% rename from hub/hub/asgi.py rename to hub/asgi.py diff --git a/hub/manage.py b/hub/manage.py deleted file mode 100755 index fe901e9..0000000 --- a/hub/manage.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python -"""Django's command-line utility for administrative tasks.""" -import os -import sys - - -def main(): - """Run administrative tasks.""" - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hub.settings") - try: - from django.core.management import execute_from_command_line - except ImportError as exc: - raise ImportError( - "Couldn't import Django. Are you sure it's installed and " - "available on your PYTHONPATH environment variable? Did you " - "forget to activate a virtual environment?" - ) from exc - execute_from_command_line(sys.argv) - - -if __name__ == "__main__": - main() diff --git a/hub/servicebroker/apps.py b/hub/servicebroker/apps.py index 063519b..475685e 100644 --- a/hub/servicebroker/apps.py +++ b/hub/servicebroker/apps.py @@ -3,4 +3,4 @@ from django.apps import AppConfig class ServicebrokerConfig(AppConfig): default_auto_field = "django.db.models.BigAutoField" - name = "servicebroker" + name = "hub.servicebroker" diff --git a/hub/servicebroker/serializers.py b/hub/servicebroker/serializers.py index e47adeb..a4e3082 100644 --- a/hub/servicebroker/serializers.py +++ b/hub/servicebroker/serializers.py @@ -1,5 +1,5 @@ from rest_framework import serializers -from services.models import Service, CloudProvider +from hub.services.models import Service, CloudProvider class ServicePlanSerializer(serializers.Serializer): diff --git a/hub/servicebroker/views.py b/hub/servicebroker/views.py index 4ccfe8d..f73e588 100644 --- a/hub/servicebroker/views.py +++ b/hub/servicebroker/views.py @@ -10,7 +10,7 @@ from .serializers import ( BindingRequestSerializer, BindingResponseSerializer, ) -from services.models import Service +from hub.services.models import Service class ServiceBrokerView(APIView): diff --git a/hub/services/apps.py b/hub/services/apps.py index 11e745d..1e3beb1 100644 --- a/hub/services/apps.py +++ b/hub/services/apps.py @@ -3,4 +3,4 @@ from django.apps import AppConfig class ServicesConfig(AppConfig): default_auto_field = "django.db.models.BigAutoField" - name = "services" + name = "hub.services" diff --git a/hub/services/migrations/0001_initial.py b/hub/services/migrations/0001_initial.py index e1a90dd..ae50eb4 100644 --- a/hub/services/migrations/0001_initial.py +++ b/hub/services/migrations/0001_initial.py @@ -1,7 +1,7 @@ # Generated by Django 5.1.5 on 2025-01-29 08:34 import django.db.models.deletion -import services.models +import hub.services.models from django.db import migrations, models @@ -67,7 +67,7 @@ class Migration(migrations.Migration): blank=True, null=True, upload_to="cloud_provider_logos/", - validators=[services.models.validate_image_size], + validators=[hub.services.models.validate_image_size], ), ), ], @@ -190,7 +190,7 @@ class Migration(migrations.Migration): blank=True, null=True, upload_to="service_logos/", - validators=[services.models.validate_image_size], + validators=[hub.services.models.validate_image_size], ), ), ("features", models.TextField()), @@ -293,7 +293,7 @@ class Migration(migrations.Migration): blank=True, null=True, upload_to="partner_logos/", - validators=[services.models.validate_image_size], + validators=[hub.services.models.validate_image_size], ), ), ("website", models.URLField(blank=True)), diff --git a/hub/services/views/leads.py b/hub/services/views/leads.py index 59c6072..a1500e7 100644 --- a/hub/services/views/leads.py +++ b/hub/services/views/leads.py @@ -3,13 +3,13 @@ from django.conf import settings from django.shortcuts import render, get_object_or_404, redirect from django.contrib import messages from django.urls import reverse -from services.models import ( +from hub.services.models import ( Service, ServiceOffering, Plan, ) -from services.forms import LeadForm -from services.odoo import OdooAPI +from hub.services.forms import LeadForm +from hub.services.odoo import OdooAPI logger = logging.getLogger(__name__) diff --git a/hub/services/views/offerings.py b/hub/services/views/offerings.py index b6fba84..a866b40 100644 --- a/hub/services/views/offerings.py +++ b/hub/services/views/offerings.py @@ -1,6 +1,6 @@ from django.shortcuts import render, get_object_or_404 from django.db.models import Q -from services.models import ( +from hub.services.models import ( ServiceOffering, CloudProvider, Category, diff --git a/hub/services/views/partners.py b/hub/services/views/partners.py index 1da7b9d..d5789f4 100644 --- a/hub/services/views/partners.py +++ b/hub/services/views/partners.py @@ -1,6 +1,6 @@ from django.shortcuts import render, get_object_or_404 from django.db.models import Q -from services.models import ( +from hub.services.models import ( ConsultingPartner, CloudProvider, ) diff --git a/hub/services/views/providers.py b/hub/services/views/providers.py index 6116501..2418fb2 100644 --- a/hub/services/views/providers.py +++ b/hub/services/views/providers.py @@ -1,6 +1,6 @@ from django.shortcuts import render, get_object_or_404 from django.db.models import Q -from services.models import ( +from hub.services.models import ( Service, CloudProvider, ) diff --git a/hub/services/views/services.py b/hub/services/views/services.py index 1d2e97c..cc65f6b 100644 --- a/hub/services/views/services.py +++ b/hub/services/views/services.py @@ -1,6 +1,6 @@ from django.shortcuts import render, get_object_or_404 from django.db.models import Q -from services.models import ( +from hub.services.models import ( Service, ConsultingPartner, CloudProvider, diff --git a/hub/hub/settings.py b/hub/settings.py similarity index 90% rename from hub/hub/settings.py rename to hub/settings.py index 3027229..6713155 100644 --- a/hub/hub/settings.py +++ b/hub/settings.py @@ -59,8 +59,8 @@ INSTALLED_APPS = [ "rest_framework", "schema_viewer", # local - "services", - "servicebroker", + "hub.services", + "hub.servicebroker", ] if DEBUG: INSTALLED_APPS += ["django_browser_reload"] @@ -169,19 +169,19 @@ MEDIA_URL = "/media/" MEDIA_ROOT = env.path("MEDIA_ROOT", default=BASE_DIR / "media") ODOO_CONFIG = { - "url": env.str("ODOO_URL"), - "db": env.str("ODOO_DB"), - "username": env.str("ODOO_USERNAME"), - "password": env.str("ODOO_PASSWORD"), + "url": env.str("ODOO_URL", default="http://localhost:8069"), + "db": env.str("ODOO_DB", default="odoo"), + "username": env.str("ODOO_USERNAME", default="odoo"), + "password": env.str("ODOO_PASSWORD", default="odoo"), } -BROKER_USERNAME = env.str("BROKER_USERNAME") -BROKER_PASSWORD = env.str("BROKER_PASSWORD") +BROKER_USERNAME = env.str("BROKER_USERNAME", default="broker") +BROKER_PASSWORD = env.str("BROKER_PASSWORD", default="secret") BASE_URL = "https://your-domain.com" REST_FRAMEWORK = { "DEFAULT_AUTHENTICATION_CLASSES": [ - "servicebroker.authentication.ServiceBrokerAuthentication", + "hub.servicebroker.authentication.ServiceBrokerAuthentication", ], "UNAUTHENTICATED_USER": None, } diff --git a/hub/hub/urls.py b/hub/urls.py similarity index 82% rename from hub/hub/urls.py rename to hub/urls.py index 9ce3d2e..ff3cef1 100644 --- a/hub/hub/urls.py +++ b/hub/urls.py @@ -5,8 +5,8 @@ from django.urls import path, include urlpatterns = [ path("admin/", admin.site.urls), - path("", include("services.urls")), - path("broker/", include("servicebroker.urls")), + path("", include("hub.services.urls")), + path("broker/", include("hub.servicebroker.urls")), ] if settings.DEBUG: urlpatterns += [ diff --git a/hub/hub/wsgi.py b/hub/wsgi.py similarity index 100% rename from hub/hub/wsgi.py rename to hub/wsgi.py diff --git a/manage.py b/manage.py new file mode 100755 index 0000000..25079b0 --- /dev/null +++ b/manage.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +import os +import sys + + +def main(): + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hub.settings") + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError("Couldn't import Django") from exc + execute_from_command_line(sys.argv) + + +if __name__ == "__main__": + main()