Added boilerplate

This commit is contained in:
depress_ed 2023-12-02 15:58:28 -06:00
commit 02f7675d18
30 changed files with 424 additions and 0 deletions

12
.gitignore vendored Normal file
View File

@ -0,0 +1,12 @@
# Virtualenv
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
.Python
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64
[Ll]ocal
[Ss]cripts
pyvenv.cfg
.venv
pip-selfcheck.json

20
License Normal file
View File

@ -0,0 +1,20 @@
Copyright (c) 2012-2023 Scott Chacon and others
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0
db.sqlite3 Normal file
View File

0
kernel_panic/__init__.py Normal file
View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

16
kernel_panic/asgi.py Normal file
View File

@ -0,0 +1,16 @@
"""
ASGI config for kernel_panic 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', 'kernel_panic.settings')
application = get_asgi_application()

124
kernel_panic/settings.py Normal file
View File

@ -0,0 +1,124 @@
"""
Django settings for kernel_panic project.
Generated by 'django-admin startproject' using Django 4.2.6.
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
# 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 = 'django-insecure-5q8tlry0@oun5alpth&q(2+r_dyh=&u+-)ywwo5e02qgl&qzql'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'pages.apps.PagesConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
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 = 'kernel_panic.urls'
TEMPLATES = [
{
'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',
],
},
},
]
WSGI_APPLICATION = 'kernel_panic.wsgi.application'
# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# 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-us'
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/'
# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

23
kernel_panic/urls.py Normal file
View File

@ -0,0 +1,23 @@
"""
URL configuration for kernel_panic 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 import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path("", include("pages.urls")),
]

16
kernel_panic/wsgi.py Normal file
View File

@ -0,0 +1,16 @@
"""
WSGI config for kernel_panic 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', 'kernel_panic.settings')
application = get_wsgi_application()

22
manage.py Executable file
View File

@ -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', 'kernel_panic.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()

0
pages/__init__.py Normal file
View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

3
pages/admin.py Normal file
View File

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

6
pages/apps.py Normal file
View File

@ -0,0 +1,6 @@
from django.apps import AppConfig
class PagesConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'pages'

View File

Binary file not shown.

3
pages/models.py Normal file
View File

@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

View File

@ -0,0 +1,3 @@
<!-- pages/templates/pages/home.html-->
<h1>Hello, World!</h1>

3
pages/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

6
pages/urls.py Normal file
View File

@ -0,0 +1,6 @@
from django.urls import path
from pages import views
urlpatterns = [
path("", views.home, name='home'),
]

5
pages/views.py Normal file
View File

@ -0,0 +1,5 @@
from django.shortcuts import render
# Create your views here.
def home(request):
return render(request, "pages/home.html", {})

162
templates/base.html Normal file
View File

@ -0,0 +1,162 @@
<!-- templates/base.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=""UTF-8>
<title>{% block title %}{% endblock title %}</title>
<style>
::-webkit-scrollbar {
display: none;
}
body, hmtl {
height: 100%;
margin: 0;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
margin-left: 10%;
margin-right: 10%;
width: 80vw;
scrollbar-width: none; /* For Firefox */
-ms-overflow-style: none;
{% block bgstuff %}
background-color: white;
{% endblock bgstuff %}
}
body img{
width: 90%;
}
#topbar {
width: 100%;
text-align: center;
border-bottom: 1px solid black;
position: sticky;
top: 0;
animation: slideDown 3s backwards;
}
@keyframes slideDown {
0% {
left: 0vw;
}
100% {
left: 50vw;
}
}
.button {
display: inline-block;
padding: 10px;
border-right: 1px solid black;
transform: background-color 0.5s;
font-size: large;
}
h1 {
text-align: left;
}
#footer {
color: inherit;
width: 100vw;
font-size: small;
-webkit-filter: invert(100%);
filter: invert(100%);
width: 100%;
text-align: center;
padding-left: 10px;
padding-right: 10px;
position: absolute;
display: block;
bottom: -75px;
background-color: inherit;
border-top: 1px solid #e7e7e7;
}
#footer a {
font-size: small;
-webkit-filter: invert(100%);
filter: invert(100%);
}
.content img {
max-width: 800px;
display: inline;
}
.content {
text-align: justify;
width: 80%;
}
}
</style>
</head>
<body>
<!-- Llegaste al código, a ver cáele al telegram -> [arroba]kprftw -->
<div id="topbar">
{% block topbar %}
<a href="/"><div class="button">a casa</div></a>
<a href="/about"><div class="button">khe?</div></a>
<a href="/somos"><div class="button">quiénes?</div></a>
<a href="/blog"><div class="button">noticiones</div></a>
<a href="/miranomasesosproyectos"><div class="button">proyectazos</div></a>
<a href="/censo-hacker-latinoamericane-2023"><div class="button">participa en el censo</div></a>
<a href="https://pat.kernelpanic.lol/calendar/#/2/calendar/view/CH1zbFeFKLPO5SPle5JNxjKqdSaidbYPYBKFC4PDSus/embed/"><div class="button">calendario</div></a>
<!-- Add more buttons as needed -->
{% endblock topbar %}
</div>
<div class='content'>
<h1>{{ this.title }}</h1>
{% block body %}{% endblock body %}
</div>
<script>
document.body.addEventListener('click', function () {
var randomColor = 'rgb(' +
Math.floor(Math.random() * 256) + ',' +
Math.floor(Math.random() * 256) + ',' +
Math.floor(Math.random() * 256) + ')';
document.body.style.backgroundColor = randomColor;
document.getElementById('topbar').style.backgroundColor = randomColor;
var rgb = randomColor.match(/\d+/g).map(Number);
// Calculate the brightness of the color
var brightness = Math.round((parseInt(rgb[0]) * 299 + parseInt(rgb[1]) * 587 + parseInt(rgb[2]) * 114) / 1000);
// Choose black or white for the font color based on the brightness
var randomFontColor = brightness > 150 ? 'black' : 'white';
document.body.style.color = randomFontColor;
});
var buttons = document.querySelectorAll('.button');
buttons.forEach(function(button) {
button.addEventListener('mouseover', function() {
var randomColor = 'rgb(' +
Math.floor(Math.random() * 256) + ',' +
Math.floor(Math.random() * 256) + ',' +
Math.floor(Math.random() * 256) + ')';
// Convert the RGB color to an array of numbers
var rgb = randomColor.match(/\d+/g).map(Number);
// Calculate the brightness of the color
var brightness = Math.round((parseInt(rgb[0]) * 299 + parseInt(rgb[1]) * 587 + parseInt(rgb[2]) * 114) / 1000);
// Choose black or white for the font color based on the brightness
var randomFontColor = brightness > 150 ? 'black': 'white';
this.style.backgroundColor = randomColor;
this.style.color = randomFontColor;
});
});
</script>
<div id="footer">
{% block footer%}
<p>Por la gracia de San iGNUcio desde el Cuarto de Máquinas @ 2023.</p>
<p>Contáctanos en <a href="https://twitter.com/botkernel">el twatter</a> para lo que se ocupe.</p>
{%endblock footer%}
</div>
</body>
</html>