From 786d41fa30ae0a78e0c789947434fafff06bfd71 Mon Sep 17 00:00:00 2001 From: Shashank Verma Date: Wed, 4 Oct 2023 09:22:45 +0530 Subject: [PATCH 1/3] contrihub: settings: Set default db variables for workflow Signed-off-by: Shashank Verma --- contrihub/settings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrihub/settings.py b/contrihub/settings.py index e06ef89..87a99b7 100644 --- a/contrihub/settings.py +++ b/contrihub/settings.py @@ -75,8 +75,8 @@ # https://docs.djangoproject.com/en/3.2/ref/settings/#databases DB_NAME = config('DB_NAME', default='contrihub') -DB_USER = config('DB_USER') -DB_PASSWORD = config('DB_PASSWORD') +DB_USER = config('DB_USER', default='dbuser') +DB_PASSWORD = config('DB_PASSWORD', default='1234') DB_HOST = config('DB_HOST', default='localhost') DB_PORT = config('DB_PORT', default='3306') From 505203f752fff1e67f2e03de42d673fc8d754343 Mon Sep 17 00:00:00 2001 From: Shashank Verma Date: Wed, 4 Oct 2023 09:30:09 +0530 Subject: [PATCH 2/3] .github: django: Setup MySQL for tests Signed-off-by: Shashank Verma --- .github/workflows/django.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index 66fafe9..057b73c 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -17,6 +17,11 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Setup MySQL + - uses: mirromutth/mysql-action@v1.1 + with: + mysql user: 'dbuser' # Required if "mysql root password" is empty, default is empty. The superuser for the specified database. Can use secrets, too + mysql password: '1234' # Required if "mysql user" exists. The password for the "mysql user" - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v3 with: From 3870660bb379527fecf7787546ac249c6a5603ea Mon Sep 17 00:00:00 2001 From: Shashank Verma Date: Wed, 4 Oct 2023 09:37:02 +0530 Subject: [PATCH 3/3] contrihub: urls: Change base url if mentioned in env Signed-off-by: Shashank Verma --- contrihub/urls.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/contrihub/urls.py b/contrihub/urls.py index 2ea180a..d6f7cf8 100644 --- a/contrihub/urls.py +++ b/contrihub/urls.py @@ -13,11 +13,14 @@ 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ +from decouple import config from django.contrib import admin # from django.conf.urls import from django.urls import path, include, re_path -urlpatterns = [ +BASE_URL = config('BASE_URL') + +basepatterns = [ path('admin/', admin.site.urls), path('', include('home.urls')), path('profile/', include('user_profile.urls')), @@ -26,3 +29,8 @@ # this url is handled by social_django app under social-auth-app-django python library re_path(r'^oauth/', include('social_django.urls', namespace='social')), ] + +if BASE_URL: + urlpatterns = [ path(str(BASE_URL), include(basepatterns)) ] +else: + urlpatterns = basepatterns