From 65255a2fd30e34486cc1cd937bf10eaed6d08efc Mon Sep 17 00:00:00 2001 From: thematdev Date: Fri, 6 Nov 2020 17:51:15 +0300 Subject: [PATCH] Migration --- main.py | 37 +++++++++++++++----- static/assets/css/style.css | 67 +++++++++++++++++++++++++++++++++---- templates/index.html | 22 ++++++++++-- templates/texindex.html | 8 +++++ 4 files changed, 115 insertions(+), 19 deletions(-) create mode 100644 templates/texindex.html diff --git a/main.py b/main.py index b8d290d..c6f5592 100644 --- a/main.py +++ b/main.py @@ -1,23 +1,42 @@ import flask +import os +import numpy.random as gaussian_rnd + + app = flask.Flask(__name__, subdomain_matching=True) -app.config['SERVER_NAME'] = 'test.sex:666' +app.config['SERVER_NAME'] = 'thematdev.local:22837' + + +def generate_iq(): + return round(gaussian_rnd.normal(loc=100.0, scale=15.0, size=None)) + + +@app.context_processor +def override_url_for(): + return dict(url_for=dated_url_for) + + +def dated_url_for(endpoint, **values): + if endpoint == 'static': + filename = values.get('filename', None) + if filename: + file_path = os.path.join(app.root_path, endpoint, filename) + values['q'] = int(os.stat(file_path).st_mtime) + return flask.url_for(endpoint, **values) @app.route('/') def index(): - return flask.render_template('index.html') + return flask.render_template('index.html', random_number=generate_iq()) -@app.route('/', subdomain='gay') -def testindex(): - print('It works!') - return flask.render_template('testindex.html') +@app.route('/', subdomain='tex') +def texindex(): + return "Fuck you, leatherman!" def main(): - app.run('test.sex', 666) - # flask.url_for('static', filename='style.css') - # flask.url_for('static', filename='fonts.css') + app.run('thematdev.local', 22837) if __name__ == '__main__': diff --git a/static/assets/css/style.css b/static/assets/css/style.css index 5910b4e..74cdafd 100644 --- a/static/assets/css/style.css +++ b/static/assets/css/style.css @@ -2,18 +2,71 @@ box-sizing: border-box; } +body { + margin: 0; +} + .pagehead { width: 100%; - height: 100%; - position: fixed; - top: 0; - left: 0; + height: 100vh; + position: relative; background: #111; + display: flex; + /*align-items: center; + justify-content: center;*/ + flex-direction: column; + margin: 0; +} + +.pagehead-inner { + position: inherit; + margin: 0; + width: 456px; + height: 600px; + top: 50%; + left: 50%; + margin-left: -228px; + margin-top: -300px; + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; +} + +.pagehead-inner > p { + color: white; + font-family: "Overpass Mono", monospace; + font-weight: 300; + margin: 0; +} + +.btn-container { + display: flex; + position: inherit; + flex-direction: row; +} + +.btn-container button { + width: 69px; + height: 69px; + margin: 10px; + background: #222; + color: white; + border-radius: 15px; +} + +.btn-container button:hover { + transform: scale(1.2); + -webkit-transition: transform 0.5s ease-in-out; + background: white; + color: green; } .mainh { color: white; - font: "Overpass Mono", monospace; - font-weight: 600; - text-align: center; + font-family: "Overpass Mono", monospace; + font-weight: 700; + margin: 0; } + +. diff --git a/templates/index.html b/templates/index.html index d7cd485..1aa7ebe 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,13 +1,29 @@ - - + + thematdev
-

thematdev

+
+

thematdev

+

Тут можно подпись какую-то сделать

+

Ваш IQ: {{ random_number }}

+
+ + + +
+
+ Идея про Гауссово распределение вместо обычного рандома: Prentor и pavel_the_best diff --git a/templates/texindex.html b/templates/texindex.html new file mode 100644 index 0000000..d9eaacd --- /dev/null +++ b/templates/texindex.html @@ -0,0 +1,8 @@ + + + + + + + +