Skip to content

Commit

Permalink
Merge branch 'main' into server-https-support
Browse files Browse the repository at this point in the history
  • Loading branch information
jaw12346 committed Nov 6, 2023
2 parents cd056f5 + 9a76360 commit 21d9603
Show file tree
Hide file tree
Showing 86 changed files with 3,411 additions and 40,875 deletions.
13 changes: 13 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: acmas
open_collective: # Replace with a single Open Collective username
ko_fi: acmas
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
- OS: [ex: iOS]
- Browser [ex: chrome, safari]
- Version [ex: 22]

**Smart Phone (please complete the following information):**
- Device: [ex: iPhone6]
- OS: [ex: iOS8.1]
- Browser [ex: chrome, safari]
- Version [ex: 22]

**Additional context**
Add any other context about the problem here.
File renamed without changes.
3 changes: 3 additions & 0 deletions .github/linters/.htmlhintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"head-script-disabled": false
}
2 changes: 1 addition & 1 deletion .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
uses: github/super-linter@v4
env:
DEFAULT_BRANCH: "main"
FILTER_REGEX_EXCLUDE: (.*./ACMAS/ACMAS_Web/migrations*|.*./ACMAS/app/ACMAS_Web/static/js*|.*./ACMAS/app/ACMAS_Web/static/styles/bootstrap*)
FILTER_REGEX_EXCLUDE: (.*./ACMAS/ACMAS_Web/migrations*|.*./ACMAS/app/ACMAS_Web/static/js*)
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_ALL_CODEBASE: false
VALIDATE_DOCKERFILE_HADOLINT: false # Turns off Dockerfile linter.
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ __pycache__/
env
ACMAS/package-lock.json
ACMAS/package.json
ACMAS/app/db.sqlite3
ACMAS/app/db.sqlite3
ACMAS/node_modules
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"python.analysis.typeCheckingMode": "off",
"liveServer.settings.port": 5501
}
15 changes: 11 additions & 4 deletions ACMAS/.env
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# DO NOT UPLOAD ANY CHANGES TO GITHUB!
DATABASE=postgres
DEBUG=1
DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1] www.acmas.systems acmas.systems
DJANGO_ALLOWED_HOSTS='localhost 127.0.0.1 [::1] 52.55.52.58 www.acmas.systems acmas.systems'
DJANGO_EMAIL=[email protected]
DJANGO_PASS=password
DJANGO_USER=acmas_admin
GOOGLE_ADSENSE_ID=INSERT_ID_HERE
GOOGLE_ADSENSE_URL=https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=
GOOGLE_ANALYTICS_ID=INSERT_ID_HERE
GOOGLE_ANALYTICS_URL=https://www.googletagmanager.com/gtag/js?id=
POSTGRES_DB=acmas_db
POSTGRES_PASSWORD=PASSWORD
POSTGRES_USER=acmas_admin
SECRET_KEY=SECRET_KEY
SQL_DATABASE=acmas_db
SQL_ENGINE=django.db.backends.postgresql
SQL_HOST=db
SQL_PASSWORD=PASSWORD
SQL_PORT=5432
SQL_USER=acmas_admin
4 changes: 0 additions & 4 deletions ACMAS/.env.db

This file was deleted.

37 changes: 24 additions & 13 deletions ACMAS/app/ACMAS/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

# 'DJANGO_ALLOWED_HOSTS' should be a single string of hosts with a space between each.
# For example: 'DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1]'
ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS", default="").split(" ")
ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS", default="").strip("'").split(" ")

# Application definition

Expand All @@ -39,13 +39,13 @@
"django.contrib.messages",
"django.contrib.staticfiles",
"ACMAS_Web",
"django_components",
]

MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
# 'django.middleware.csrf.CsrfViewMiddleware',
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
Expand All @@ -57,14 +57,23 @@
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
"loaders": [
(
"django.template.loaders.cached.Loader",
[
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
"django_components.template_loader.Loader",
],
)
],
},
},
]
Expand All @@ -76,10 +85,10 @@
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
DATABASES = {
"default": {
"ENGINE": os.environ.get("SQL_ENGINE", "django.db.backends.sqlite3"),
"NAME": os.environ.get("SQL_DATABASE", BASE_DIR / "db.sqlite3"),
"USER": os.environ.get("SQL_USER", "user"),
"PASSWORD": os.environ.get("SQL_PASSWORD", "password"),
"ENGINE": os.environ.get("SQL_ENGINE", "django.db.backends.postgresql"),
"NAME": os.environ.get("POSTGRES_DB", BASE_DIR / "acmas_db"),
"USER": os.environ.get("POSTGRES_USER", "user"),
"PASSWORD": os.environ.get("POSTGRES_PASSWORD", "password"),
"HOST": os.environ.get("SQL_HOST", "localhost"),
"PORT": os.environ.get("SQL_PORT", "5432"),
}
Expand Down Expand Up @@ -120,17 +129,19 @@
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/
# Any request to http://localhost:8000/static/* will be served from "staticfiles" directory (development)
STATIC_URL = "/static/"
STATIC_ROOT = BASE_DIR / "staticfiles"
STATICFILES_DIRS = [os.path.join(BASE_DIR, STATIC_URL)]
STATIC_URL = "staticfiles/" # URL to serve static files (/home/app/web/staticfiles/)
STATIC_ROOT = os.path.join(
BASE_DIR, "staticfiles"
) # Collect static files here (production)

# Media files
MEDIA_URL = "/media/"
MEDIA_ROOT = BASE_DIR / "mediafiles"
MEDIA_URL = "media/"
MEDIA_ROOT = os.path.join(BASE_DIR, "mediafiles")

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

DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

# CSRF_TRUSTED_ORIGINS = ['http://localhost:1337']
LOGIN_REDIRECT_URL = "/"
LOGOUT_REDIRECT_URL = "/"
2 changes: 1 addition & 1 deletion ACMAS/app/ACMAS/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

# ACMAS homepage
def index(request):
return render(request, "../static/index.html")
return render(request, "../ACMAS_Web/templates/index.html")
14 changes: 12 additions & 2 deletions ACMAS/app/ACMAS_Web/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# from django.contrib import admin
from django.contrib import admin

# Register your models here.
from .models import Course, Question, University, UploadedFile, User

admin.site.register(Question)
admin.site.register(University)
admin.site.register(Course)
admin.site.register(UploadedFile)
admin.site.register(User)

admin.site.site_header = "ACMAS Admin"
admin.site.site_title = "ACMAS Admin Portal"
admin.site.index_title = "Welcome to the ACMAS Administration Portal"
7 changes: 7 additions & 0 deletions ACMAS/app/ACMAS_Web/components/button/button.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<span class="button-component pt-2">
{% if component_type == "primary" %}
<button type="submit" class="px-4 py-2 rounded-xl text-white text-semibold text-lg bg-blue-600 hover:bg-blue-700 transition ease-in duration-200" value="{{ value }}" name="{{ name }}">{{ text }}</button>
{% elif component_type == "secondary" %}
<button type="submit" class="px-4 py-2 rounded-xl text-gray-700 text-semibold border border-gray-300 text-lg bg-white hover:bg-gray-100 transition ease-in duration-200" value="{{ value }}" name="{{ name }}">{{ text }}</button>
{% endif %}
</span>
14 changes: 14 additions & 0 deletions ACMAS/app/ACMAS_Web/components/button/button.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from django_components import component


@component.register("button")
class Button(component.Component):
template_name = "button/button.html"

def get_context_data(self, text, component_type, value, name=""):
return {
"text": text,
"component_type": component_type,
"value": value,
"name": name,
}
7 changes: 7 additions & 0 deletions ACMAS/app/ACMAS_Web/components/field/field.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div class="field-component p-0.5">
{% if component_type == "input" %}
<input type="file" class="block w-full text-sm text-gray-900 border border-gray-300 rounded-lg cursor-pointer bg-gray-50 dark:text-gray-400 focus:outline-none dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400" name="{{ name }}">
{% else %}
<input type="text" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" name="{{ name }}" placeholder="{{ placeholder }}">
{% endif %}
</div>
13 changes: 13 additions & 0 deletions ACMAS/app/ACMAS_Web/components/field/field.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from django_components import component


@component.register("field")
class Field(component.Component):
template_name = "field/field.html"

def get_context_data(self, placeholder, name, component_type):
return {
"placeholder": placeholder,
"name": name,
"component_type": component_type,
}
Loading

0 comments on commit 21d9603

Please sign in to comment.