diff --git a/.gitignore b/.gitignore index caeecc5..8b944b0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,28 @@ -# Remove all development files -uploads/ +### Postgres template +postgres -# remove all PyCharm files +### Editors template .idea - -# remove all VSCode files .vscode +blogs -# remove all CSS files -static/css/style.css -static/css/style.css.map +### Django template +*.log +*.pot +*.pyc +__pycache__/ +local_settings.py +db.sqlite3 +db.sqlite3-journal +# media # By default you dont want this to be commited, but I run my server on Docker so bleh +CACHE +/data +# If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/ +# in your Git repository. Update and uncomment the following line accordingly. +# /staticfiles/ + +### Python template # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] @@ -33,7 +45,6 @@ parts/ sdist/ var/ wheels/ -pip-wheel-metadata/ share/python-wheels/ *.egg-info/ .installed.cfg @@ -63,6 +74,7 @@ coverage.xml *.py,cover .hypothesis/ .pytest_cache/ +cover/ # Translations *.mo @@ -85,6 +97,7 @@ instance/ docs/_build/ # PyBuilder +.pybuilder/ target/ # Jupyter Notebook @@ -95,7 +108,9 @@ profile_default/ ipython_config.py # pyenv -.python-version +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. @@ -104,7 +119,22 @@ ipython_config.py # install all needed dependencies. #Pipfile.lock -# PEP 582; used by e.g. github.com/David-OConnor/pyflow +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ # Celery stuff @@ -140,3 +170,16 @@ dmypy.json # Pyre type checker .pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..a5efa1b --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +My little Django website + blog + +## Installation +Clone this repo and cd into it + +### Running +```bash +docker-compose up +``` + +### First time setup + +```bash +docker-compose exec website python3 /app/manage.py createsuperuser +``` + +ok bye! diff --git a/app.py b/app.py deleted file mode 100644 index 1679628..0000000 --- a/app.py +++ /dev/null @@ -1,205 +0,0 @@ -from flask import Flask, render_template, request, jsonify -from flask_compress import Compress - -import dotenv - -from random import choice -import json -import requests - -# Getting color palette from album art -import colorthief - -LASTFM_API_KEY = dotenv.get_key('./.env', 'LASTFM') - -app = Flask(__name__) -Compress(app) - - -# -# ROUTES -# -@app.route('/') -def index(): - msg = [ - 'Don\'t cry because it\'s over, smile because it happened', - 'This could go one of two ways...', 'Gwa Gwa', - 'It\'s a UNIX system! I know this!', '*internal screaming*', - 'Don\'t forget to drink water!', 'I wish we were better strangers.', - 'If I were you, I\'d run now', 'SILICA GEL "DO NOT EAT".', - 'Gods die too.', 'Eat hotchip and lie' - ] - - return render_template('index.html', msg=choice(msg)) - - -@app.route('/cretura') -def cretura(): - return render_template('cretura.html') - - -@app.route('/about') -def about(): - """ - Returns a dict with all the languages I know and their level of knowledge - 0 = Absolute beginner - 1 = Basics - 2 = Intermediate - 3 = Advanced - 4 = Expert - 5 = Undefeated - """ - languages = { - 'Python': { - 'level': 3, - 'since': '2020', - 'color': '#3776AB', - }, - 'HTML': { - 'level': 4, - 'since': '2021', - 'color': '#E34F26', - }, - 'CSS': { - 'level': 3, - 'since': '2021', - 'color': '#1572B6', - }, - 'JavaScript': { - 'level': 2, - 'since': '2022', - 'color': '#F7DF1E', - }, - 'Sass/SCSS': { - 'level': 4, - 'since': '2022', - 'color': '#CC6699', - }, - 'PHP': { - 'level': 2, - 'since': '2022', - 'color': '#777BB4', - }, - 'SQL': { - 'level': 1, - 'since': '2022', - 'color': '#4479A1', - }, - 'Scratch': { - 'level': 5, - 'since': '2015', - 'color': '#FFD500', - }, - 'Shell': { - 'level': 2, - 'since': '2021', - 'color': '#89E051', - }, - 'Rust': { - 'level': 0, - 'since': '2023', - 'color': '#CE422B', - }, - } - - systems = { - 'Ubuntu': { - 'level': 2, - 'since': '2022', - 'color': '#E95420', - }, - 'Arch': { - 'level': 3, - 'since': '2021', - 'color': '#1793D1', - }, - 'Proxmox': { - 'level': 2, - 'since': '2021', - 'color': '#E57000', - }, - 'Windows': { - 'level': 1, - 'since': '2011', - 'color': '#0078D6', - }, - } - return render_template('about.html', languages=languages, systems=systems) - - -@app.route('/music', methods=['GET', 'POST']) -def music(): - if request.method == 'POST': - current_tracks = requests.get( - f'http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=Fluffy_Bean_&api_key={LASTFM_API_KEY}&limit=5&format=json' - ) - current_tracks = json.loads(current_tracks.text) - - tracks = [] - - for track in current_tracks['recenttracks']['track']: - # As django is weird with @attr in json data - # I make a new dict with a bool for nowPlaying - nowPlaying = False - if '@attr' in track: - nowPlaying = True - - # Yoink color palette from album art - color_thief = colorthief.ColorThief( - requests.get(track['image'][2]['#text'], stream=True).raw) - palette = color_thief.get_palette() - - tmp_track = { - 'name': track['name'], - 'artist': track['artist']['#text'], - 'album': track['album']['#text'], - 'url': track['url'], - 'image': track['image'][2]['#text'], - 'nowPlaying': nowPlaying, - 'palette': palette[0] - } - - tracks.append(tmp_track) - - return jsonify(tracks) - - # GET request - return render_template('music.html') - - -# -# ERROR HANDLERS -# -@app.errorhandler(405) -def method_not_allowed(e): - error = '405' - msg = 'Method sussy wussy' - return render_template('error.html', error=error, msg=msg), 404 - - -@app.errorhandler(404) -def page_not_found(e): - error = '404' - msg = 'Could not find what you need!' - return render_template('error.html', error=error, msg=msg), 404 - - -@app.errorhandler(403) -def forbidden(e): - error = '403' - msg = 'Go away! This is no place for you!' - return render_template('error.html', error=error, msg=msg), 403 - - -@app.errorhandler(410) -def gone(e): - error = '410' - msg = 'The page is no longer available! *sad face*' - return render_template('error.html', error=error, msg=msg), 410 - - -@app.errorhandler(500) -def internal_server_error(e): - error = '500' - msg = 'Server died inside :c' - return render_template('error.html', error=error, msg=msg), 500 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a7651d9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,28 @@ +version: "3.9" + +services: + db: + image: postgres:alpine + restart: unless-stopped + volumes: + - ./postgres/data:/var/lib/postgresql/data + environment: + POSTGRES_USER: ${POSTGRES_USER} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + POSTGRES_DB: ${POSTGRES_DB} + + + website: + build: website + restart: unless-stopped + volumes: + - ./data/media:/website/media + environment: + DJANGO_KEY: ${DJANGO_KEY} + POSTGRES_USER: ${POSTGRES_USER} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + POSTGRES_DB: ${POSTGRES_DB} + depends_on: + - db + ports: + - "6212:8000" diff --git a/static/css/buttons.sass b/static/css/buttons.sass deleted file mode 100644 index be6b94c..0000000 --- a/static/css/buttons.sass +++ /dev/null @@ -1,36 +0,0 @@ -.btn - margin: 0 - padding: 0.5rem 1rem - - width: auto - height: 2.5rem - - position: relative - - display: flex - justify-content: center - align-items: center - - border: transparent 0 solid - border-radius: 2px - - background: $black - color: $white !important - - font-size: 1rem - font-weight: 500 - line-height: 1 - - text-decoration: none - text-align: center - text-transform: uppercase - - cursor: pointer - transition: all 0.2s ease-in-out - - &:hover - background: $white - color: $black !important - - &:focus - outline: none \ No newline at end of file diff --git a/static/css/style.sass b/static/css/style.sass deleted file mode 100644 index a6c1aa4..0000000 --- a/static/css/style.sass +++ /dev/null @@ -1,430 +0,0 @@ -@use 'sass:map' - -$black: #101010 -$dark: #151515 -$grey: #808080 -$white: #e8e3e3 -$primary: #8C977D - -@font-face - font-family: 'jetbrains_monoitalic' - src: url('../fonts/jetbrainsmono-italic-variablefont_wght-webfont.woff2') format('woff2'), url('../fonts/jetbrainsmono-italic-variablefont_wght-webfont.woff') format('woff') - font-weight: normal - font-style: normal - font-display: swap -@font-face - font-family: 'jetbrains_monoregular' - src: url('../fonts/jetbrainsmono-variablefont_wght-webfont.woff2') format('woff2'), url('../fonts/jetbrainsmono-variablefont_wght-webfont.woff') format('woff') - font-weight: normal - font-style: normal - font-display: swap - -html - margin: 0 - padding: 0 -body - margin: 0 - padding: 3rem 1rem 1rem - width: 100vw - min-height: 100vh - - background-color: $black - - font-family: 'jetbrains_monoregular', sans-serif - - display: flex - justify-content: center - align-items: center - - overflow-x: hidden - box-sizing: border-box - - * - box-sizing: border-box - -nav - margin: 0 - padding: 0.5rem 1rem - - width: 100vw - height: 3rem - - position: fixed - top: 0 - left: 0 - - display: flex - justify-content: center - align-items: center - gap: 1rem - - z-index: 1 - - color: $white - - a - margin: 0 - padding: 0 - - width: auto - height: 2rem - - position: relative - - display: flex - justify-content: center - align-items: center - - font-size: 1.1rem - font-weight: 400 - line-height: 1 - - text-align: left - text-decoration: none - text-transform: uppercase - - color: $grey - - &:hover - color: $white - - a.selected - color: $primary - - &:hover - color: $white - - span - margin: 0 0 0.2rem 0 - padding: 0 - - width: 2px - height: 1.25rem - - position: relative - - display: flex - justify-content: center - align-items: center - - background-color: $grey - -.wrapper - margin: 0 auto - padding: 1rem - - width: 100% - max-width: 621px - - min-height: auto - - position: relative - - display: flex - flex-direction: column - gap: 1rem - - background: $dark - color: $white - border-radius: 2px - - z-index: 2 - box-sizing: border-box - //overflow: hidden - - h1 - margin: 0 // 0 1rem 0 - padding: 0 - - font-size: 2.25rem - font-weight: 600 - line-height: 1 - - text-align: left - text-transform: uppercase - white-space: break-spaces - - h2 - margin: 0 - padding: 0 - - font-size: 1.5rem - font-weight: 600 - line-height: 1 - - text-align: left - text-transform: uppercase - - h3 - margin: 0 - padding: 0 - - font-size: 1.25rem - font-weight: 600 - line-height: 1 - - text-align: left - text-transform: uppercase - - p - margin: 0 - padding: 0 - - font-size: 1.1rem - font-weight: 400 - line-height: 1.2 - - text-align: left - - color: $grey - - a - margin: 0 - padding: 0 - - font-size: 1.1rem - font-weight: 400 - line-height: 1.2 - - text-align: left - - color: $primary - - &:hover - color: $white - - img - margin: 0 auto - padding: 0 - - width: auto - max-width: 100% - - position: relative - - display: block - - border-radius: 2px - - object-fit: cover - - z-index: 1 - -p.subtitle - color: $white - text-transform: uppercase - -.content - display: flex - flex-direction: column - justify-content: space-between - gap: 0.5rem - - //overflow: hidden - -.bar-chart - margin: 0 - padding: 0 - - position: relative - - display: flex - flex-direction: column - gap: 0.5rem - -.marker - width: 2px - height: 100% - - position: absolute - top: 0 - left: 0 - - background-color: rgba($white, 0.1) - - z-index: -2 - -.sub_experiance - width: 0% - height: 1.69rem - - position: relative - - background-color: $primary - border-radius: 2px - - transition: width 2s cubic-bezier(.86,0,.07,1) - - .fg - width: 100% - height: 100% - - position: absolute - - overflow: hidden - - span - position: absolute - top: 50% - left: 1.5rem - transform: translateY(-50%) - - font-size: 0.9rem - font-weight: 600 - white-space: nowrap - - color: $black - - .bg - position: absolute - top: 50% - left: 1.5rem - transform: translateY(-50%) - - font-size: 0.9rem - font-weight: 600 - white-space: nowrap - - color: $white - - z-index: -1 - -@keyframes loader - 0% - width: 0 - left: 0 - 30% - width: 100% - left: 0 - 60% - width: 100% - left: 100% - 100% - width: 100% - left: 100% - -.loader - margin: 1rem 0 - - width: 100% - height: 2px - - position: relative - - background-color: $black - - overflow: hidden - - &::after - content: '' - - margin: 0 - padding: 0 - - width: 0 - height: 100% - - position: absolute - top: 0 - left: 0 - - background-color: $primary - - animation: loader 1s ease-in-out infinite - -.music - display: flex - flex-direction: column - gap: 1rem - -.track - display: flex - flex-direction: row - gap: 1rem - - position: relative - - overflow: hidden - -.track-image - padding: 0px - - // Its too late for me to be bothered to fix a bug I have - min-width: 5rem - width: 5rem - max-width: 5rem - min-height: 5rem - height: 5rem - max-height: 5rem - - border-radius: 2px - background-color: $black - - transition: all 0.3s cubic-bezier(.86,0,.07,1) - - img - margin: 0 - padding: 0 - - width: 100% - height: 100% - - display: block - float: left - - border-radius: 2px - background-color: $dark - - opacity: 1 - object-fit: cover - - transition: all 0.2s cubic-bezier(.86,0,.07,1) - -.track-info - display: flex - flex-direction: column - //justify-content: space-between - gap: 0.5rem - - overflow: hidden - - a - margin: 0 - padding: 0 - - font-size: 1.1rem - font-weight: 600 - line-height: 1.2 - - text-align: left - text-decoration: none - - color: $white - - &:hover - color: $primary - -p.track-nowplaying - color: $primary - -@import "buttons" -@import "toast" - -@media (max-width: 669px) - .wrapper - max-width: 100% - border-radius: 0 - - h1 - font-size: 2rem - text-align: center - - p.subtitle - text-align: center - - .track-image - width: 2px - height: auto - - img - opacity: 0 \ No newline at end of file diff --git a/static/css/toast.sass b/static/css/toast.sass deleted file mode 100644 index 947da13..0000000 --- a/static/css/toast.sass +++ /dev/null @@ -1,89 +0,0 @@ -@keyframes toastTimeout - 0% - left: -100% - 100% - left: 0% - -.toast-container - margin: 0 - padding: 0 - - width: 100% - height: auto - max-width: 400px - - position: fixed - bottom: 0.5rem - left: 50% - transform: translateX(-50%) - - display: flex - flex-direction: column - gap: 0.5rem - - font-size: 1rem - font-weight: 500 - line-height: 1 - text-align: center - - z-index: 9999 - -.toast - margin: 0 - padding: 0.5rem 1rem - - min-height: 2.5rem - - position: relative - - display: flex - justify-content: center - align-items: center - - transform: scaleY(0) - - color: $white - background-color: $dark - border-radius: 2px - - opacity: 0 - - transition: all 0.3s ease-in-out - overflow: hidden - - &:hover - cursor: pointer - -.toast-show - opacity: 1 - transform: scaleY(1) - -.toast-hide - opacity: 0 - tansform: translateY(5rem) - -.toast-time - margin: 0 - padding: 0 - - width: 100% - height: 2px - - position: absolute - bottom: 0 - left: 0% - - background-color: $primary - - animation: toastTimeout 5s linear forwards - -@media (max-width: 669px) - .toast-container - padding: 0.5rem - - width: 100% - max-width: 100% - - bottom: 0 - left: 0 - transform: none \ No newline at end of file diff --git a/static/fonts/jetbrainsmono-italic-variablefont_wght-webfont.woff b/static/fonts/jetbrainsmono-italic-variablefont_wght-webfont.woff deleted file mode 100644 index 8bd716b..0000000 Binary files a/static/fonts/jetbrainsmono-italic-variablefont_wght-webfont.woff and /dev/null differ diff --git a/static/fonts/jetbrainsmono-italic-variablefont_wght-webfont.woff2 b/static/fonts/jetbrainsmono-italic-variablefont_wght-webfont.woff2 deleted file mode 100644 index 1ca13f0..0000000 Binary files a/static/fonts/jetbrainsmono-italic-variablefont_wght-webfont.woff2 and /dev/null differ diff --git a/static/fonts/jetbrainsmono-variablefont_wght-webfont.woff b/static/fonts/jetbrainsmono-variablefont_wght-webfont.woff deleted file mode 100644 index 7c463d3..0000000 Binary files a/static/fonts/jetbrainsmono-variablefont_wght-webfont.woff and /dev/null differ diff --git a/static/fonts/jetbrainsmono-variablefont_wght-webfont.woff2 b/static/fonts/jetbrainsmono-variablefont_wght-webfont.woff2 deleted file mode 100644 index 186f54a..0000000 Binary files a/static/fonts/jetbrainsmono-variablefont_wght-webfont.woff2 and /dev/null differ diff --git a/static/images/ny.png b/static/images/ny.png deleted file mode 100644 index 00a67ab..0000000 Binary files a/static/images/ny.png and /dev/null differ diff --git a/static/js/main.js b/static/js/main.js deleted file mode 100644 index 7eaa429..0000000 --- a/static/js/main.js +++ /dev/null @@ -1,87 +0,0 @@ -function addToast(text='Sample toast notification') { - var container = document.querySelector('.toast-container'); - - // Create notification element - var parent = document.createElement('span'); - parent.classList.add('toast'); - parent.innerText = text; - parent.onclick = function() { - if (parent.parentNode) { - parent.classList.add('toast-hide'); - - setTimeout(function() { - container.removeChild(parent); - }, 500); - } - }; - - // Create span to show time remaining - var timer = document.createElement('span'); - timer.classList.add('toast-time'); - parent.appendChild(timer); - - // Append notification to container - container.appendChild(parent); - setTimeout(function() { - parent.classList.add('toast-show'); - }, 1); - - // Remove notification after 5 seconds - setTimeout(function() { - if (parent.parentNode) { - parent.classList.add('toast-hide'); - - setTimeout(function() { - container.removeChild(parent); - }, 500); - } - }, 5000); -} - -function garble(obj, speed=1) { - const letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_-" - - let interval = null; - let iteration = 0; - - clearInterval(interval); - - interval = setInterval(() => { - obj.innerText = obj.innerText - .split("") - .map((letter, index) => { - if (index < iteration) { - return obj.dataset.value[index]; - } - // 27 as hyphens wrap text that can make page jump a lot - return letters[Math.floor(Math.random() * 27)] - }) - .join(""); - - if(iteration >= obj.dataset.value.length){ - clearInterval(interval); - } - - iteration += 1 / speed; - }, 30); -} - - -// Main title and subtitle, should only be one of each per page -if (document.querySelector("h1")) { - const title = document.querySelector("h1"); - garble(title, 1.5); -} -if (document.querySelector(".subtitle")) { - const subtitle = document.querySelector(".subtitle"); - garble(subtitle); -} - - -// h2 and h3 headers on page, there can be multiple so we need to loop through them -if (document.querySelectorAll("h2, h3")) { - const headers = document.querySelectorAll("h2, h3"); - headers.forEach((header) => { - garble(header); - }); -} \ No newline at end of file diff --git a/templates/about.html b/templates/about.html deleted file mode 100644 index 0711613..0000000 --- a/templates/about.html +++ /dev/null @@ -1,104 +0,0 @@ -{% extends 'layout.html' %} -{% block nav_about %}selected{% endblock %} - -{% block content %} -
-

About-Me

-
- -
-

Meeeeeee

-

Hewwo, I'm a 17 year old nerd, who likes to code and tinker with computers!

-

I'm mostly a frontend developer, with some knowlage of the backend. I also enjoy programming for the hell of it

-

Fluffy Bean is a maned wolf, he reflects my personality and is my fursona

-

Refsheet made by mrHDash

-
- - Orange maned wolf sneaking under a yellow sheet - -
-

Experiance and Projects

-

I'm quite well experianced with Python, HTML, CSS/Sass, and Shell Scripting.And have some experiance with JavaScript, PHP, MySQL and a few other languages

-

My main operating system has been Linux for about 1.5 years (Arch btw)

-

Now I have started to learn hardware and been messing around with Pi Picos!

-

Recently I have started working on a gallery, originally written in PHP for my own use before making it public

-

It is now written in Python with Flask and is open source! You can find it on GitHub. Or on my self hosted instance of Gitea!

-
- -
-

Level of knowlage

-

My levels of knowlage are based on a scale of 0-5, with 0 being very little experiance and 5 being best in the world, obviously ;3

- - -

Languages

- {% for lang in languages %} - - {{ lang }} - Since {{ languages[lang].since }} - {{ lang }} - Since {{ languages[lang].since }} - - {% endfor %} - -

OS'

- {% for os in systems %} - - {{ os }} - Since {{ systems[os].since }} - {{ os }} - Since {{ systems[os].since }} - - {% endfor %} - - - - - - -
-
- - -{% endblock %} \ No newline at end of file diff --git a/templates/cretura.html b/templates/cretura.html deleted file mode 100644 index a6a4407..0000000 --- a/templates/cretura.html +++ /dev/null @@ -1,23 +0,0 @@ -{% extends 'layout.html' %} -{% block nav_cretura %}selected{% endblock %} - -{% block content %} -

Cretura

-

Thanks to these critters!

- -
-

Jeetix: Helping me with learning how to make websites!

-

Carty: Teaching me how to run servers and the networking!

-

mrHDash: For the Ref Sheet, also my smelly brother

-

Zadok: Silly taidum art on the icon of this page!

- -
- - -{% endblock %} \ No newline at end of file diff --git a/templates/error.html b/templates/error.html deleted file mode 100644 index c118c0e..0000000 --- a/templates/error.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends 'layout.html' %} -{% block content %} -
-

{{error}}

-

{{msg}}

-
-{% endblock %} \ No newline at end of file diff --git a/templates/index.html b/templates/index.html deleted file mode 100644 index 6cc0a70..0000000 --- a/templates/index.html +++ /dev/null @@ -1,28 +0,0 @@ -{% extends 'layout.html' %} -{% block nav_home %}selected{% endblock %} - -{% block content %} -
-

Social-Media

-

{{msg}}

-
- -
- Twitter - Mastodon - Telegram - Github - -
- - -{% endblock %} \ No newline at end of file diff --git a/templates/layout.html b/templates/layout.html deleted file mode 100644 index 05c303e..0000000 --- a/templates/layout.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - Leggy land - - - - - - - - -
- {% block content %} {% endblock %} -
- -
- - \ No newline at end of file diff --git a/templates/music.html b/templates/music.html deleted file mode 100644 index 7472ebd..0000000 --- a/templates/music.html +++ /dev/null @@ -1,103 +0,0 @@ -{% extends 'layout.html' %} -{% block nav_music %}selected{% endblock %} - -{% block content %} -

Muuuuuuusic

- -
- -
- -
-

Provided by Last.fm

-
- - -{% endblock %} \ No newline at end of file diff --git a/website/Dockerfile b/website/Dockerfile new file mode 100644 index 0000000..dedf951 --- /dev/null +++ b/website/Dockerfile @@ -0,0 +1,18 @@ +# syntax=docker/dockerfile:1 +FROM alpine:latest + +EXPOSE 8000 +RUN apk update && apk add build-base postgresql-client \ + python3 py3-pip python3-dev --no-cache + +RUN mkdir /app +WORKDIR /app + +COPY requirements.txt requirements.txt +RUN pip install -r requirements.txt + +COPY website . +COPY run.sh run.sh +RUN chmod +x run.sh + +CMD ["./run.sh"] diff --git a/website/requirements.txt b/website/requirements.txt new file mode 100644 index 0000000..028cd76 --- /dev/null +++ b/website/requirements.txt @@ -0,0 +1,8 @@ +Gunicorn +django +psycopg2-binary +tzdata +pillow +django-libsass +django-compressor +django-markdownify diff --git a/website/run.sh b/website/run.sh new file mode 100644 index 0000000..a03d5a4 --- /dev/null +++ b/website/run.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +# Wait for database to start +until pg_isready -d $POSTGRES_DB -h db -U $POSTGRES_USER +do + echo "Waiting for database to start... (5s)" + sleep 5 +done + +echo "Database is ready!" + +# Check if there are any changes to the database +#python3 manage.py showmigrations +if (python3 manage.py showmigrations | grep "\[ \]" > /dev/null); +then + echo "Database changes detected! Migrating..." + python3 manage.py makemigrations + python3 manage.py migrate +fi + +# Start server!!!! +echo "Starting server..." +gunicorn --bind :8000 website.wsgi:application + diff --git a/website/website/articles/__init__.py b/website/website/articles/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/website/website/articles/admin.py b/website/website/articles/admin.py new file mode 100644 index 0000000..1c982e1 --- /dev/null +++ b/website/website/articles/admin.py @@ -0,0 +1,5 @@ +from django.contrib import admin +from articles.models import Article + + +admin.site.register(Article) diff --git a/website/website/articles/apps.py b/website/website/articles/apps.py new file mode 100644 index 0000000..9baf7c9 --- /dev/null +++ b/website/website/articles/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class ArticlesConfig(AppConfig): + default_auto_field = "django.db.models.BigAutoField" + name = "articles" diff --git a/website/website/articles/migrations/0001_initial.py b/website/website/articles/migrations/0001_initial.py new file mode 100644 index 0000000..96fe50c --- /dev/null +++ b/website/website/articles/migrations/0001_initial.py @@ -0,0 +1,30 @@ +# Generated by Django 4.2.2 on 2023-06-17 12:01 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + initial = True + + dependencies = [] + + operations = [ + migrations.CreateModel( + name="Article", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("title", models.CharField(max_length=255)), + ("slug", models.SlugField()), + ("body", models.TextField()), + ("date", models.DateTimeField(auto_now_add=True)), + ], + ), + ] diff --git a/website/website/articles/migrations/0002_article_thumb.py b/website/website/articles/migrations/0002_article_thumb.py new file mode 100644 index 0000000..dcb55dd --- /dev/null +++ b/website/website/articles/migrations/0002_article_thumb.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.2 on 2023-06-17 14:24 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("articles", "0001_initial"), + ] + + operations = [ + migrations.AddField( + model_name="article", + name="thumb", + field=models.ImageField(blank=True, default="default.png", upload_to=""), + ), + ] diff --git a/website/website/articles/migrations/0003_alter_article_thumb.py b/website/website/articles/migrations/0003_alter_article_thumb.py new file mode 100644 index 0000000..60ca252 --- /dev/null +++ b/website/website/articles/migrations/0003_alter_article_thumb.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.2 on 2023-06-17 14:34 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("articles", "0002_article_thumb"), + ] + + operations = [ + migrations.AlterField( + model_name="article", + name="thumb", + field=models.ImageField(blank=True, default="default.jpg", upload_to=""), + ), + ] diff --git a/website/website/articles/migrations/0004_article_published.py b/website/website/articles/migrations/0004_article_published.py new file mode 100644 index 0000000..6f4484d --- /dev/null +++ b/website/website/articles/migrations/0004_article_published.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.2 on 2023-06-18 17:18 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("articles", "0003_alter_article_thumb"), + ] + + operations = [ + migrations.AddField( + model_name="article", + name="published", + field=models.BooleanField(default=False), + ), + ] diff --git a/website/website/articles/migrations/__init__.py b/website/website/articles/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/website/website/articles/models.py b/website/website/articles/models.py new file mode 100644 index 0000000..04ae9ab --- /dev/null +++ b/website/website/articles/models.py @@ -0,0 +1,13 @@ +from django.db import models + + +class Article(models.Model): + title = models.CharField(max_length=255) + slug = models.SlugField() + body = models.TextField() + date = models.DateTimeField(auto_now_add=True) + thumb = models.ImageField(default="default.jpg", blank=True) + published = models.BooleanField(default=False) + + def __str__(self): + return self.title diff --git a/website/website/articles/tests.py b/website/website/articles/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/website/website/articles/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/website/website/articles/urls.py b/website/website/articles/urls.py new file mode 100644 index 0000000..321dc91 --- /dev/null +++ b/website/website/articles/urls.py @@ -0,0 +1,26 @@ +""" +URL configuration for website project. + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/4.2/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.urls import path +from articles import views + + +app_name = "articles" + +urlpatterns = [ + path("", views.article_list, name="list"), + path("/", views.article_detail, name="detail"), +] diff --git a/website/website/articles/views.py b/website/website/articles/views.py new file mode 100644 index 0000000..d2604d0 --- /dev/null +++ b/website/website/articles/views.py @@ -0,0 +1,17 @@ +from django.shortcuts import render, get_object_or_404 +from django.http import HttpResponse +from articles.models import Article + + +def article_list(request): + articles = Article.objects.filter(published=True).order_by("-date").all() + return render(request, "views/articles.html", {"articles": articles}) + + +def article_detail(request, slug): + article = get_object_or_404(Article, slug=slug) + + if not article.published: + return HttpResponse("Not found") + + return render(request, "views/article.html", {"article": article}) diff --git a/website/website/manage.py b/website/website/manage.py new file mode 100644 index 0000000..f425f2f --- /dev/null +++ b/website/website/manage.py @@ -0,0 +1,22 @@ +#!/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", "website.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/website/website/media/default.jpg b/website/website/media/default.jpg new file mode 100644 index 0000000..ff67619 Binary files /dev/null and b/website/website/media/default.jpg differ diff --git a/website/website/static/images/kissing-men.png b/website/website/static/images/kissing-men.png new file mode 100644 index 0000000..7a820da Binary files /dev/null and b/website/website/static/images/kissing-men.png differ diff --git a/website/website/static/images/mood.png b/website/website/static/images/mood.png new file mode 100644 index 0000000..d94413d Binary files /dev/null and b/website/website/static/images/mood.png differ diff --git a/static/images/ref.png b/website/website/static/images/ref.png similarity index 100% rename from static/images/ref.png rename to website/website/static/images/ref.png diff --git a/static/images/sneak.png b/website/website/static/images/sneak.png similarity index 100% rename from static/images/sneak.png rename to website/website/static/images/sneak.png diff --git a/static/images/taidum.png b/website/website/static/images/taidum.png similarity index 100% rename from static/images/taidum.png rename to website/website/static/images/taidum.png diff --git a/website/website/static/js/navigation.js b/website/website/static/js/navigation.js new file mode 100644 index 0000000..dade96d --- /dev/null +++ b/website/website/static/js/navigation.js @@ -0,0 +1,30 @@ +let navRotate = 0; +let increment = 45; + +function toggleNav() { + let nav = document.querySelector('nav'); + let button = document.querySelector('.nav-toggle'); + + navRotate += increment; + button.style.transform = `rotate(${navRotate}deg)`; + + if (nav.classList.contains('open')) { + document.querySelector('body').style.overflow = 'auto'; + + nav.classList.remove('open'); + setTimeout(() => { + nav.style.display = 'none'; + }, 100); + + button.classList.remove('open'); + } else { + document.querySelector('body').style.overflow = 'hidden'; + + nav.style.display = 'flex'; + setTimeout(() => { + nav.classList.add('open'); + }, 3); + + button.classList.add('open'); + } +} diff --git a/website/website/static/js/scroll.js b/website/website/static/js/scroll.js new file mode 100644 index 0000000..36f7fe3 --- /dev/null +++ b/website/website/static/js/scroll.js @@ -0,0 +1,11 @@ +const scroll = document.querySelector('.scroll'); + +function setScroll() { + let scrollPercentage = (window.scrollY / (document.body.scrollHeight - window.innerHeight)) * 100; + scroll.style.width = scrollPercentage + '%'; +} + +if (scroll) { + setScroll(); + window.onscroll = () => { setScroll(); }; +} diff --git a/website/website/static/sass/styles.sass b/website/website/static/sass/styles.sass new file mode 100644 index 0000000..2e54ba2 --- /dev/null +++ b/website/website/static/sass/styles.sass @@ -0,0 +1,225 @@ +$dark: #261f1b +$light: #f0e7e4 +$accent: #f2672c + +$radius: 2px + +$font: 'DM Serif Display', serif +$font-mono: 'IBM Plex Mono', monospace + +@import "styles/navigation" +@import "styles/footer" +@import "styles/markdown" +@import "styles/table" +@import "styles/art-block" +@import "styles/button-array" + +* + font-family: $font + box-sizing: border-box + + -ms-overflow-style: none // for Internet Explorer, Edge + scrollbar-width: none // for Firefox + + &::-webkit-scrollbar + display: none // for Chrome, Safari, and Opera + +html + font-size: 1rem + background-color: $light + +body + margin: 0 + padding: 0 + min-height: 100vh + display: flex + flex-direction: column + color: $dark + +.back + padding: 0 + width: 3rem + height: 3rem + + display: flex + justify-content: center + align-items: center + + position: fixed + right: 1.3rem + bottom: 1.3rem + + border: 0 solid transparent + border-radius: 50% + background: $dark + box-shadow: 0 0 0.35rem rgba(0, 0, 0, 0.4) + + cursor: pointer + z-index: 10 + + svg + display: block + width: 1.4rem + height: 1.4rem + color: $light + + &:hover + text-decoration: none + +.scroll + width: 0 + height: 0.3rem + + position: fixed + bottom: 0 + left: 0 + + background: $accent + z-index: 4 + +header + width: 100% + height: 20rem + + position: relative + + display: flex + flex-direction: column + justify-content: center + align-items: center + + background-color: $dark + color: $light + box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.2) + z-index: 2 + overflow: hidden + + img + width: 100% + height: 100% + position: absolute + inset: 0 + object-fit: cover + + h1 + margin: 0 0 0.5rem 0 + padding: 0 1rem + position: relative + font-size: 4rem + text-align: center + background: inherit + color: inherit + border-radius: $radius + z-index: +1 + + p + margin: 0 + padding: 0.3rem 1rem + position: relative + text-align: center + background: inherit + color: inherit + border-radius: $radius + z-index: +1 + +@media (max-width: 900px) + header + height: 13rem + + h1 + font-size: 3rem + +main + margin: 0 auto + padding: 1rem 1rem 0 1rem + + font-size: 1.1rem + + flex-grow: 1 + + width: 100% + max-width: 900px + height: 100% + + img + max-width: 100% + object-fit: cover + border-radius: $radius + + h1 + margin: 0 0 0.5rem 0 + font-size: 2.5rem + color: $accent + + a + color: $accent + text-decoration: none + &:hover + text-decoration: underline + +.article + margin: 0 0 0.5rem 0 + display: flex + justify-content: space-between + align-items: baseline + + position: relative + + text-decoration: none + background: $light + color: $dark + + h2 + margin: 0 0.5rem 0.2rem 0 + padding-right: 0.75rem + + font-size: 1.69rem + white-space: nowrap + text-overflow: ellipsis + + background: inherit + color: inherit + + overflow: hidden + transition: color 0.1s ease-in-out + z-index: +1 + + p + margin: 0 + padding-left: 0.75rem + + font-size: 1rem + white-space: nowrap + + background: inherit + color: inherit + + transition: color 0.1s ease-in-out + z-index: +1 + + &::after + content: "" + width: 100% + + display: block + position: absolute + top: 50% + left: 0 + + border-top: 1px $dark dotted + + opacity: 0.5 + transition: background 0.1s ease-in-out + + &:hover + color: $accent + text-decoration: none + +@media (max-width: 600px) + .article + h2 + font-size: 1.4rem +@media (max-width: 400px) + .article + h2 + font-size: 1.1rem diff --git a/website/website/static/sass/styles/art-block.sass b/website/website/static/sass/styles/art-block.sass new file mode 100644 index 0000000..79a911e --- /dev/null +++ b/website/website/static/sass/styles/art-block.sass @@ -0,0 +1,34 @@ +.art-block + height: auto + display: grid + grid-template-columns: repeat(3, 1fr) + gap: 0.5rem + + .art + display: flex + flex-direction: column + + span + margin-bottom: 0.2rem + width: 100% + height: 100% + position: relative + background: $light + border-radius: $radius + + img + max-width: 100% + max-height: 100% + position: absolute + top: 50% + left: 50% + transform: translate(-50%, -50%) + +@media (max-width: 621px) + .art-block + grid-template-columns: 1fr 1fr + grid-template-rows: 1fr 1fr +@media (max-width: 420px) + .art-block + grid-template-columns: 1fr + grid-template-rows: 1fr \ No newline at end of file diff --git a/website/website/static/sass/styles/button-array.sass b/website/website/static/sass/styles/button-array.sass new file mode 100644 index 0000000..a300fdb --- /dev/null +++ b/website/website/static/sass/styles/button-array.sass @@ -0,0 +1,53 @@ +.button-array + display: flex + flex-wrap: wrap + justify-content: start + + p + margin: 0 0.2rem 0 0 + padding: 0 0.5rem + + height: 2rem + + display: flex + align-items: center + + font-size: 0.9rem + font-family: $font-mono + + background: $dark + color: $light + border-radius: $radius + + button, a + margin: 0 0.2rem 0.2rem 0 + padding: 0 + + width: 2rem + height: 2rem + + display: flex + justify-content: center + align-items: center + + font-size: 0.9rem + font-family: $font-mono + text-decoration: none + + background-color: $accent + color: $dark + border: 0 solid transparent + border-radius: $radius + + transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out + + svg + width: 1.1rem + height: 1.1rem + color: inherit + + &:hover, &:focus-visible + text-decoration: none + background-color: $dark + color: $light + outline: none diff --git a/website/website/static/sass/styles/footer.sass b/website/website/static/sass/styles/footer.sass new file mode 100644 index 0000000..db7cf14 --- /dev/null +++ b/website/website/static/sass/styles/footer.sass @@ -0,0 +1,28 @@ +footer + width: 100% + height: 5.6rem + + display: flex + flex-direction: column + justify-content: center + align-items: center + + background-color: $light + color: $dark + + p + margin: 0 + font-size: 0.9rem + text-align: center + color: inherit + + a + margin: 0 + font-size: 0.9rem + + text-decoration: none + color: $accent + cursor: pointer + + &:hover + text-decoration: underline diff --git a/website/website/static/sass/styles/markdown.sass b/website/website/static/sass/styles/markdown.sass new file mode 100644 index 0000000..4749535 --- /dev/null +++ b/website/website/static/sass/styles/markdown.sass @@ -0,0 +1,47 @@ +.markdown + a + text-decoration: none + color: $accent + transition: all 0.1s ease-in-out + + &:hover + text-decoration: underline + + hr + margin: 1rem 0 + border: 0 + border-top: 1px solid $dark + + code + padding: 0.2rem + + font-family: $font-mono + font-size: 0.8rem + + background-color: $dark + color: $light + border-radius: $radius + + overflow-x: auto + + pre + margin: 0 + padding: 0.6rem + + white-space: pre-wrap + word-wrap: break-word + font-family: $font-mono + + background-color: $dark + border-radius: $radius + + overflow-x: scroll + + > code + padding: 0 + + blockquote + margin: 1rem 0 1rem 1.5rem + padding: 0 0.6rem + font-style: italic + border-left: 0.2rem solid $accent diff --git a/website/website/static/sass/styles/navigation.sass b/website/website/static/sass/styles/navigation.sass new file mode 100644 index 0000000..f4269f0 --- /dev/null +++ b/website/website/static/sass/styles/navigation.sass @@ -0,0 +1,101 @@ +nav + padding-bottom: 1rem + + position: fixed + right: 0 + left: 0 + + width: 100% + height: calc(100vh + 1rem) + + display: none + flex-direction: column + justify-content: center + align-items: center + + border-radius: 0 + background-color: $dark + color: $light + + opacity: 0 + transform: translateY(-1rem) + transition: transform 0.2s ease-in-out, opacity 0.2s ease-in-out + z-index: 9998 + + a + margin: 0 0 1rem 0 + padding: 0.3rem 1rem + + position: relative + + text-decoration: none + font-weight: bold + font-size: 1.5rem + + color: $light + + transition: color 0.1s ease-in-out + + &::before + content: "" + display: block + + position: absolute + bottom: 0 + left: 0 + + width: 100% + height: 0 + + background-color: $accent + border-radius: $radius + + z-index: -1 + transition: height 0.1s ease-in-out + + &:hover, &:focus-visible + color: $dark + border: 0 solid transparent + outline: 0 solid transparent + + &::before + height: 100% + + &.open + opacity: 1 + transform: translateY(0) + +.nav-toggle + margin: 0 + padding: 0 + + position: fixed + left: 1.3rem + bottom: 1.3rem + + display: flex + justify-content: center + align-items: center + + width: 3rem + height: 3rem + + border: 0 solid transparent + border-radius: 50% + background: $dark + color: $light + box-shadow: 0 0 0.35rem rgba(0, 0, 0, 0.4) + + transition: all 0.2s ease-in-out + cursor: pointer + z-index: 9999 + + svg + display: block + width: 1.4rem + height: 1.4rem + color: inherit + + &.open + background: $light + color: $dark diff --git a/website/website/static/sass/styles/table.sass b/website/website/static/sass/styles/table.sass new file mode 100644 index 0000000..7b66679 --- /dev/null +++ b/website/website/static/sass/styles/table.sass @@ -0,0 +1,35 @@ +.table + width: 100% + border-radius: $radius + overflow: hidden + border: 1px solid $dark + + table + border: none + border-collapse: collapse + width: 100% + + tr + border: none + border-bottom: 1px solid $dark + + &:last-child + border: none + + th, td + padding: 0.5rem + text-align: left + vertical-align: top + border-right: 1px solid $dark + + &:last-child + border: none + + th + background: $dark + color: $light + +@media (max-width: 768px) + .table table + th, td + padding: 0.25rem diff --git a/website/website/templates/base.html b/website/website/templates/base.html new file mode 100644 index 0000000..dbd146a --- /dev/null +++ b/website/website/templates/base.html @@ -0,0 +1,34 @@ +{% load static %} +{% load compress %} + + + + + {% block title %}Leggy Land{% endblock %} + + + + + + + + + + {% compress css %} + + {% endcompress %} + + + + {% block navigation %}{% include 'navigation.html' %}{% endblock %} + {% block header %}{% endblock %} +
{% block content %}{% endblock %}
+
{% block footer %}{% include 'footer.html' %}{% endblock %}
+ + + {% block scripts %}{% endblock %} + {% compress js %} + + + {% endcompress %} + diff --git a/website/website/templates/footer.html b/website/website/templates/footer.html new file mode 100644 index 0000000..377ae8f --- /dev/null +++ b/website/website/templates/footer.html @@ -0,0 +1,2 @@ +Website source +

Designed by meeee

diff --git a/website/website/templates/navigation.html b/website/website/templates/navigation.html new file mode 100644 index 0000000..561e33f --- /dev/null +++ b/website/website/templates/navigation.html @@ -0,0 +1,11 @@ + + + diff --git a/website/website/templates/views/article.html b/website/website/templates/views/article.html new file mode 100644 index 0000000..fa6e58f --- /dev/null +++ b/website/website/templates/views/article.html @@ -0,0 +1,23 @@ +{% extends 'base.html' %} +{% load markdownify %} + +{% block title %}{{ article.title }}{% endblock %} + +{% block header %} + + +
+ {{ article.title }} +

{{ article.title }}

+

{{ article.date }}

+
+{% endblock %} + +{% block content %} +
{{ article.body|markdownify }}
+ + + + + +{% endblock %} diff --git a/website/website/templates/views/articles.html b/website/website/templates/views/articles.html new file mode 100644 index 0000000..90646b7 --- /dev/null +++ b/website/website/templates/views/articles.html @@ -0,0 +1,10 @@ +{% extends 'base.html' %} +{% block content %} +

Articles

+ {% for article in articles %} + +

{{ article.title }}

+

{{ article.date|date:"jS M, Y" }}

+
+ {% endfor %} +{% endblock %} diff --git a/website/website/templates/views/index.html b/website/website/templates/views/index.html new file mode 100644 index 0000000..219d86c --- /dev/null +++ b/website/website/templates/views/index.html @@ -0,0 +1,82 @@ +{% extends 'base.html' %} +{% load static %} + +{% block content %} +

Hello, stranger!

+

About Meeeeee

+

My name is Fluffy, I'm an 18-year-old nerd, who likes to code and tinker with computers!

+ FluffyBean +

I specialise in Front-End development, but also enjoy working with the back end. + My Favorite framework currently is Flask, but this website runs on Django, lol

+

My favorite language is Python, but I also know how to use PHP, HTML, CSS/Sass, JavaScript, + Docker, SQL, Shell Scripting, and a little bit of Rust.

+

I also have experience in a few different systems, mainly Arch, Ubuntu and Proxmox.

+ +

Projects

+

I'm currently working on a few projects, including

+
+ + + + + + + + + + + + + + + + + + + + + +
NameLanguageFramework
OnlyLegsPythonFlask
LynxieRustSenerity
TheFrontRoomsC# & PythonUnity & Flask
+
+ +

And some of my past project include

+ +
+ + + + + + + + + + + + + + + + + + + + + +
NameLanguageFramework
OnlyLegsPHPI hate myself
Joe The BotPythondiscord.py
Twitter Archive ParserPHP and PythonRaw Dogging
+
+ +

My Socials

+

Here are my socials, if you want to stalk me

+ + + +

Please don't message me with a "hi" or "hello, how are you". Start a meaningful conversation, + chances of me responding will be slim otherwise!

+{% endblock %} diff --git a/website/website/templates/views/refsheet.html b/website/website/templates/views/refsheet.html new file mode 100644 index 0000000..1735f59 --- /dev/null +++ b/website/website/templates/views/refsheet.html @@ -0,0 +1,93 @@ +{% extends 'base.html' %} +{% load static %} + +{% block content %} +

Fluffeeeeee

+

Refsheet

+ FluffyBean +
+

mrHDash

+ + + + + + + + + + +
+ +

Art

+
+
+ FluffyBean +
+

Shep

+ + + + + +
+
+ +
+ FluffyBean +
+

Zadok

+
+
+ +
+ FluffyBean +
+

LordPulex

+ + + + + + + + + + +
+
+ +
+ FluffyBean +
+

OggyTheFox

+ + + + + + + + + + +
+
+
+{% endblock %} + +{% block scripts %} + +{% endblock %} diff --git a/website/website/website/__init__.py b/website/website/website/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/website/website/website/asgi.py b/website/website/website/asgi.py new file mode 100644 index 0000000..7a5a9d0 --- /dev/null +++ b/website/website/website/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for website 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/4.2/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "website.settings") + +application = get_asgi_application() diff --git a/website/website/website/settings.py b/website/website/website/settings.py new file mode 100644 index 0000000..06ee609 --- /dev/null +++ b/website/website/website/settings.py @@ -0,0 +1,175 @@ +"""Leggy Land is a website for the Leggy Land community. +Django settings for website project. + +Generated by 'django-admin startproject' using Django 4.2.2. + +For more information on this file, see +https://docs.djangoproject.com/en/4.2/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/4.2/ref/settings/ +""" + +from pathlib import Path +from os.path import join +from os import getenv + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = getenv("DJANGO_KEY") + +# 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", + "articles", + "compressor", + "markdownify.apps.MarkdownifyConfig", +] + +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 = "website.urls" + +TEMPLATES = [ + { + "BACKEND": "django.template.backends.django.DjangoTemplates", + "DIRS": [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 = "website.wsgi.application" + + +# Database +# https://docs.djangoproject.com/en/4.2/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': "django.db.backends.postgresql", + 'NAME': getenv('POSTGRES_DB'), + 'USER': getenv('POSTGRES_USER'), + 'PASSWORD': getenv('POSTGRES_PASSWORD'), + 'HOST': 'db', + 'PORT': 5432, + } +} + + +# Password validation +# https://docs.djangoproject.com/en/4.2/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/4.2/topics/i18n/ + +LANGUAGE_CODE = "en-gb" + +TIME_ZONE = "UTC" + +USE_I18N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/4.2/howto/static-files/ + +STATIC_URL = "static/" +STATICFILES_DIRS = (join(BASE_DIR, "static"),) +STATICFILES_FINDERS = [ + "compressor.finders.CompressorFinder", + "django.contrib.staticfiles.finders.FileSystemFinder", + "django.contrib.staticfiles.finders.AppDirectoriesFinder", +] + +MEDIA_URL = "media/" +MEDIA_ROOT = join(BASE_DIR, "media") + +COMPRESS_ROOT = join(BASE_DIR, "static/") +COMPRESS_PRECOMPILERS = (("text/x-sass", "django_libsass.SassCompiler"),) + +# Default primary key field type +# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" + +MARKDOWNIFY = { + "default": { + "WHITELIST_TAGS": [ + "a", + "p", + "h2", + "h3", + "h4", + "h5", + "h6", + "strong", + "em", + "ul", + "ol", + "li", + "blockquote", + "img", + "pre", + "code", + "hr", + "br", + "table", + "thead", + "tbody", + "tr", + "th", + "td", + ], + }, +} diff --git a/website/website/website/urls.py b/website/website/website/urls.py new file mode 100644 index 0000000..813b8b5 --- /dev/null +++ b/website/website/website/urls.py @@ -0,0 +1,32 @@ +""" +URL configuration for website project. + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/4.2/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib.staticfiles.urls import staticfiles_urlpatterns +from django.conf.urls.static import static +from django.conf import settings +from django.contrib import admin +from django.urls import path, include +from website import views + +urlpatterns = [ + path("admin/", admin.site.urls), + path("", views.index, name="index"), + path("refsheet/", views.refsheet, name="refsheet"), + path("articles/", include("articles.urls")), +] + +urlpatterns += staticfiles_urlpatterns() +urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/website/website/website/views.py b/website/website/website/views.py new file mode 100644 index 0000000..90e65fd --- /dev/null +++ b/website/website/website/views.py @@ -0,0 +1,9 @@ +from django.shortcuts import render + + +def index(request): + return render(request, "views/index.html") + + +def refsheet(request): + return render(request, "views/refsheet.html") diff --git a/website/website/website/wsgi.py b/website/website/website/wsgi.py new file mode 100644 index 0000000..3fdd807 --- /dev/null +++ b/website/website/website/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for website 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/4.2/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "website.settings") + +application = get_wsgi_application()