2021-01-12 22:07:54 +03:00
|
|
|
from dotenv import load_dotenv
|
2020-11-07 15:10:52 +03:00
|
|
|
from flask import Flask, url_for, render_template
|
2020-11-06 17:51:15 +03:00
|
|
|
import os
|
2020-11-07 15:10:52 +03:00
|
|
|
import json
|
2020-11-06 17:51:15 +03:00
|
|
|
import numpy.random as gaussian_rnd
|
2021-12-31 18:50:07 +03:00
|
|
|
from app.snowfall import generate_snowfall
|
2020-11-06 17:51:15 +03:00
|
|
|
|
2021-01-12 22:07:54 +03:00
|
|
|
load_dotenv()
|
2020-11-06 17:51:15 +03:00
|
|
|
|
2021-01-12 21:32:05 +03:00
|
|
|
""".. ..,.,,,. . . .
|
|
|
|
. . ....... ...,%&%/,.. .... .*#&&%*... .... . . .. ..
|
|
|
|
.. .. ,.. . ...,(&% ,........,..,. ... .. .*#%/..,. .. ....,. .... . ...
|
|
|
|
, .. .. ... .. /%*. ... .... ., ........ ..., . ,.#%#. ...,.. . ,., ,,
|
|
|
|
..... ... ..*%/ ... ..... ............ .....,. .,.,(* ........,,..,.,..,.
|
|
|
|
.........,.*&(. ... .......... . ....... ..,/*.,,,. *& . .....,,....,...,
|
|
|
|
.,........,(,.. . . ...../*..,. ..%*,...., ......... .
|
|
|
|
*. .... (%, *#.,.,,,,#% .**(#.,,,./&.%, .... .... ......
|
|
|
|
,....... (% .#.,,*#*,,,% ,*.#,,,,,#%.#% .. .,.,..,..
|
|
|
|
...... /@& *#&%%%&(, ./ .,/. .#% .., ....
|
|
|
|
. . .%@@%. *@%*,**,,**,,,,..,,,....*.,.//*%#/(,@.
|
|
|
|
.%@@@@@( .*#%%&%@%%&%%&(%#&@##@%*(%(/,..*%@#
|
|
|
|
(@@@@&(&, /&#.,,,,...,,,,*,,***,,.&@#%.
|
|
|
|
(@@@@&. /@* /%#*.,*..% &&##@#
|
|
|
|
(@@@@&(, *&#. .*///(% @@#.
|
|
|
|
.%@@@@@@@( .(%#/ ,% &% *(/.
|
|
|
|
,@@@@@@@@@%, /##%**, ,(%. &/ .(% ..#/(**.
|
|
|
|
,@@@@@@@@@@@/ .,,,,,,,,,,. *% &/ *%@&@%(,*&&&&%
|
|
|
|
,@@@@@@@@@@@@@* ,@( @@@%.. ,@@&@@..#&*#&,
|
|
|
|
,@@@@@@%@@@@@@% ,&# *##(** .#%@&#@&/
|
|
|
|
,@@@@@@@@@@@@@@&/. @@/ *&. .&@@@@@@%.
|
|
|
|
,@@@@@@@@@@@@@@@@@@&#(*, (@/ ,& #@@@@@@@@@
|
|
|
|
,@@@@@%.%@@@@@@@@@@@@@@@@@@@/ .#& ,@@. &@@@@@@.
|
|
|
|
,@@@@@% ,&@@@@@@@@@@@@@@@@@@@&(&@@@@@#(///*/%## &@@@@@@
|
|
|
|
,@@@@@% .&@@@@@@&%&@@@@@@@@@@@@@@@@@@@@/ &@@@@@&
|
|
|
|
,@@@@@# ,&@@@@@# ,(#&@@@@@@@@@@@@@@@@&**. &@@@@@&
|
|
|
|
,@@@@@* .@@@@@@%. ,@@@@@@@@@@@@@@@@@@@@@@#.. ,@@@@@@*
|
|
|
|
*@@@@@, (@@@@@@/ @@@@@@@@@./%&@@@@@@@@@@@@@@@@@%*,(@@@@@@,
|
|
|
|
,@@@@@, .(@@@@@&/ ,@@@@@@@&. ..,(@@@@@@@@@@@@@@@@@@@@.
|
|
|
|
#@@@@@, .(@@@@@&#@@@@@@@&* .((%%@@@@@@@@@@@&.
|
|
|
|
#@@@@&. .&@@@@@@@@@@@#. .,*%&@@@@@%
|
|
|
|
#@@@@&. (@@@@@@@@@ ** """
|
|
|
|
|
|
|
|
|
2021-09-08 14:29:24 +03:00
|
|
|
app = Flask(__name__)
|
2020-11-06 17:51:15 +03:00
|
|
|
|
|
|
|
|
|
|
|
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)
|
2020-11-07 15:10:52 +03:00
|
|
|
return url_for(endpoint, **values)
|
2020-11-04 11:30:38 +03:00
|
|
|
|
|
|
|
|
|
|
|
@app.route('/')
|
|
|
|
def index():
|
2020-11-07 15:10:52 +03:00
|
|
|
with open('config/json/projects.json') as file:
|
|
|
|
data = json.loads(file.read())
|
|
|
|
cols = data['cols']
|
|
|
|
projects = data['projects']
|
2021-12-31 18:50:07 +03:00
|
|
|
snowflake_image_url = dated_url_for('static', filename='images/snowflake.png')
|
|
|
|
return render_template('index.html', random_number=generate_iq(), projects=projects, snowfall=generate_snowfall(snowflake_image_url))
|