Skip to content

Commit

Permalink
feat: initialize main module and deploy yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew4Coding committed Sep 30, 2024
1 parent f08fe84 commit 8499074
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 4 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Push to PWS

on:
push:
branches: [ main, master ]
paths-ignore:
- '**.md'
pull_request:
branches: [ main, master ]
paths-ignore:
- '**.md'

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Check PWS remote, pull, merge, and push
env:
PWS_URL: ${{ secrets.PWS_URL }}
run: |
echo "Creating temporary branch"
git checkout -b tmp
# Push to master branch and capture the output
push_output=$(git push $PWS_URL tmp:master 2>&1)
if [[ $? -ne 0 ]]; then
echo "Push failed with output: $push_output"
echo "Error: Unable to push changes. Please check the error message above and resolve any conflicts manually."
exit 1
fi
echo "Push successful with output: $push_output"
12 changes: 9 additions & 3 deletions eventyog/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,17 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'main'
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'eventyog.urls'
Expand Down Expand Up @@ -115,9 +116,14 @@
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.1/howto/static-files/

STATIC_URL = 'static/'
STATIC_URL = '/static/'
STATICFILES_DIRS = [BASE_DIR / 'static']

# Default primary key field type
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

STATIC_ROOT = BASE_DIR / 'staticfiles'

STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
3 changes: 2 additions & 1 deletion eventyog/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.urls import path, include

urlpatterns = [
path('admin/', admin.site.urls),
path('', include('main.urls'))
]
Empty file added main/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions main/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions main/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class MainConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'main'
Empty file added main/migrations/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions main/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
3 changes: 3 additions & 0 deletions main/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
8 changes: 8 additions & 0 deletions main/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.urls import path
from main.views import *

app_name = 'main'

urlpatterns = [
path('', main, name='main'),
]
5 changes: 5 additions & 0 deletions main/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.shortcuts import render, HttpResponse

# Create your views here.
def main(request):
return HttpResponse("Hello, World!")

0 comments on commit 8499074

Please sign in to comment.