init & temp homepage

master
km0 2 years ago
commit 8fb4c4371e

18
.gitignore vendored

@ -0,0 +1,18 @@
venv/
*.pyc
__pycache__/
.ipynb_checkpoints
instance/
.pytest_cache/
.coverage
htmlcov/
dist/
build/
*.egg-info/
.env
.vscode

@ -0,0 +1,17 @@
import os
class Config(object):
DEBUG = False
TESTING = False
URL_PREFIX = ""
class ProductionConfig(Config):
DEBUG = False
URL_PREFIX = os.environ.get("URL_PREFIX")
class DevelopmentConfig(Config):
ENV = "development"
DEVELOPMENT = True
DEBUG = True

@ -0,0 +1,10 @@
from setuptools import find_packages, setup
setup(
name="postit",
version="1.0.0",
packages=find_packages(),
include_package_data=True,
zip_safe=False,
install_requires=["flask", "python-dotenv"],
)

@ -0,0 +1,40 @@
import os
from flask import Flask, send_from_directory
from . import prefix
def create_app(test_config=None):
# Create and configure the Flask App
app = Flask(__name__, instance_relative_config=True)
app.config.from_mapping(
SECRET_KEY="dev",
)
if test_config is None:
# load the instance config, if it exists, when not testing
app.config.from_pyfile("config.py", silent=True)
else:
# load the test config if passed in
app.config.from_mapping(test_config)
# ensure the instance folder exists
try:
os.makedirs(app.instance_path)
except OSError:
pass
@app.route("/favicon.ico")
def favicon():
return send_from_directory(
os.path.join(app.root_path, "static"),
"favicon.ico",
mimetype="image/vnd.microsoft.icon",
)
from . import home
app.register_blueprint(home.bp)
return app

@ -0,0 +1,9 @@
from flask import Blueprint, render_template
bp = Blueprint("home", __name__, url_prefix="/")
@bp.route("/")
def home():
return render_template("home.html")

@ -0,0 +1,14 @@
class PrefixMiddleware(object):
def __init__(self, app, prefix=""):
self.app = app
self.prefix = prefix
def __call__(self, environ, start_response):
if environ["PATH_INFO"].startswith(self.prefix):
environ["PATH_INFO"] = environ["PATH_INFO"][len(self.prefix) :]
environ["SCRIPT_NAME"] = self.prefix
return self.app(environ, start_response)
else:
start_response("404", [("Content-Type", "text/plain")])
return ["This url does not belong to the app.".encode()]

@ -0,0 +1,44 @@
* {
box-sizing: border-box;
}
:root {
--color: #8f00ff;
--light-color: #e8cdfe;
}
html,
body {
margin: 0;
}
body {
background-color: var(--light-color);
}
header {
width: 100%;
height: 100vh;
text-align: center;
color: var(--color);
font-family: Arial, Helvetica, sans-serif;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
h1 {
font-family: "SI17";
font-size: 64px;
text-transform: uppercase;
color: var(--color); /* Fallback color */
-webkit-text-fill-color: var(--light-color); /* Will override color (regardless of order) */
-webkit-text-stroke-width: 1.5px;
-webkit-text-stroke-color: var(--color);
}
.date {
font-size: 24px;
}

@ -0,0 +1,8 @@
@font-face {
font-family: "SI17";
src: url("SpecialIssue17-Regular.woff2") format("woff2"),
url("SpecialIssue17-Regular.woff") format("woff");
font-weight: normal;
font-style: normal;
font-display: swap;
}

@ -0,0 +1,19 @@
let palettes = {
purple: {
color: "#8f00ff",
lightColor: "#E8CDFE",
},
orange: {
color: "#FFF",
lightColor: "#FF6100",
},
};
window.addEventListener("load", () => {
let shade = Math.random() > 0.5 ? "purple" : "orange";
color = palettes[shade]["color"];
lightColor = palettes[shade]["lightColor"];
document.documentElement.style.setProperty("--color", color);
document.documentElement.style.setProperty("--light-color", lightColor);
});

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>SI17 - This box found you for a reason</title>
<link rel="stylesheet" href="{{url_for('static', filename='font/font.css')}}" />
<link rel="stylesheet" href="{{url_for('static', filename='css/global.css')}}" />
<script src="{{url_for('static', filename='js/color.js')}}" defer></script>
</head>
<body>
<header>
<h1>This box <br />found you <br />for a reason</h1>
<div class="date">25.3.2022</div>
</header>
</body>
</html>
Loading…
Cancel
Save