Commit e2f57ed9 authored by Aedin Hunter A. Clay's avatar Aedin Hunter A. Clay

added basic templaes, database setup, urls

parents
.env
*.pyc
**/media
.vscode
\ No newline at end of file
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class BoardConfig(AppConfig):
name = 'board'
from django.db import models
# Create your models here.
from django.test import TestCase
# Create your tests here.
from django.urls import path
from . import views
urlpatterns = [
]
from django.shortcuts import render
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class HomepageConfig(AppConfig):
name = 'homepage'
from django.db import models
# Create your models here.
from django.test import TestCase
# Create your tests here.
from django.urls import path
from . import views
urlpatterns = [
path('', views.redirect_to_home),
path('home/', views.homepage_view),
]
\ No newline at end of file
from django.shortcuts import redirect, render
def redirect_to_home(request):
return redirect('home/')
def homepage_view(request):
return render(request, 'homepage/homepage.html')
\ No newline at end of file
#!/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', 'project_questboard.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()
"""
ASGI config for project_questboard project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project_questboard.settings')
application = get_asgi_application()
from pathlib import Path
from dotenv import load_dotenv
import os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
#Load local environment variables
load_dotenv()
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '#(49vncg1=2+(7=73as12d0*_h52w6$2%-sjqmtj@580mr+(-k'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'project_questboard',
'homepage',
'board',
]
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',
]
ROOT_URLCONF = 'project_questboard.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'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',
],
},
},
]
WSGI_APPLICATION = 'project_questboard.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': str(os.getenv("DB_NAME")),
'USER': str(os.getenv("DB_USER")),
'PASSWORD': str(os.getenv("DB_PASS")),
'HOST': 'localhost',
'PORT': '5432',
}
}
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('homepage.urls')),
path('questboard/', include('board.urls')),
]
"""
WSGI config for project_questboard project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project_questboard.settings')
application = get_wsgi_application()
<!--Template for basic web page in Questboard.-->
{% load static %}
<html>
<head>
<title>{% block title %}{% endblock %}</title>
<!--Add Roboto font from Google Fonts-->
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
<!-- Base Style Sheet -->
<link rel = "stylesheet" href = "{% static 'styles.css' %}">
<!-- Additional Style Sheets-->
{% block styles %}{% endblock %}
</head>
<body>
<p class = "website_header">QUESTBOARD</p>
<div id="contents">
<p class = "page_header">{% block header %}{% endblock %}</p>
{% block content %}{% endblock %}
</div>
{% block scripts %}{% endblock %}
</body>
</html>
\ No newline at end of file
{% extends 'base.html' %}
{% load static %}
{% block title%}{{questboard.name}}{% endblock %}
{% block styles %}
<link rel = "stylesheet" href = "{% static 'board/board.css' %}">
{% endblock %}
{% block header %}{{questboard.name}}{% endblock %}
{% block content %}
<button onclick="showAddQuest()">Add Quest</button>
<dialog id="add_quest"><!-- PLEASE PREVENT NEGATIVE NUMBERS!!!-->
<form action = "add_quest" method = "post">
{% csrf_token %}
{{ add_quest_form }}
<button type="submit">Add</button>
</form>
<button onclick = "closeAllDialogBoxes()">Cancel</button>
</dialog>
{% if quests %}
Quests in the Questboard:
<ul>
{% for quest in quests %}
<li>{{quest.name}}</li>
{% endfor %}
<ul>
{% endif %}
{% endblock %}
{% block scripts %}
<script>
AddQuest = document.getElementById('add_quest');
function closeAllDialogBoxes(){
AddQuest.close();
}
function showAddQuest(){
closeAllDialogBoxes();
AddQuest.show();
}
</script>
{% endblock %}
\ No newline at end of file
{% extends 'base.html' %}
{% load static %}
{% block title%}Homepage{% endblock %}
{% block styles %}
<link rel = "stylesheet" href = "{% static 'homepage/homepage.css' %}">
{% endblock %}
{% block header %}Homepage{% endblock %}
{% block content %}
nothing so far
{% endblock %}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment