From e61828bfa73972d54add0f7bb5bd5adafdcce2a1 Mon Sep 17 00:00:00 2001 From: fox Date: Tue, 12 Jan 2021 22:07:54 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=90=D0=A1=D0=9A=D0=A3=D0=A0x1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .flaskenv | 1 + .gitignore | 3 +++ main.py => app/__init__.py | 16 ++++------------ {static => app/static}/assets/css/fonts.css | 0 {static => app/static}/assets/css/style.css | 0 {static => app/static}/assets/css/teststyle.css | 0 .../static}/assets/images/chatmanager.png | Bin {static => app/static}/assets/images/soon.jpg | Bin .../static}/assets/images/thissite.png | Bin {static => app/static}/js/projects.js | 0 {templates => app/templates}/index.html | 2 +- {templates => app/templates}/testindex.html | 0 {templates => app/templates}/texindex.html | 0 config/json/main.json | 10 ---------- 14 files changed, 9 insertions(+), 23 deletions(-) create mode 100644 .flaskenv create mode 100644 .gitignore rename main.py => app/__init__.py (88%) rename {static => app/static}/assets/css/fonts.css (100%) rename {static => app/static}/assets/css/style.css (100%) rename {static => app/static}/assets/css/teststyle.css (100%) rename {static => app/static}/assets/images/chatmanager.png (100%) rename {static => app/static}/assets/images/soon.jpg (100%) rename {static => app/static}/assets/images/thissite.png (100%) rename {static => app/static}/js/projects.js (100%) rename {templates => app/templates}/index.html (94%) rename {templates => app/templates}/testindex.html (100%) rename {templates => app/templates}/texindex.html (100%) delete mode 100644 config/json/main.json diff --git a/.flaskenv b/.flaskenv new file mode 100644 index 0000000..0dbded6 --- /dev/null +++ b/.flaskenv @@ -0,0 +1 @@ +FLASK_APP=app:app \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..80adff4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.env +**/__pycache__/ +.idea/ \ No newline at end of file diff --git a/main.py b/app/__init__.py similarity index 88% rename from main.py rename to app/__init__.py index 8e1c45c..d4d45d0 100644 --- a/main.py +++ b/app/__init__.py @@ -1,8 +1,10 @@ +from dotenv import load_dotenv from flask import Flask, url_for, render_template import os import json import numpy.random as gaussian_rnd +load_dotenv() """.. ..,.,,,. . . . . . ....... ...,%&%/,.. .... .*#&&%*... .... . . .. .. @@ -39,9 +41,6 @@ import numpy.random as gaussian_rnd app = Flask(__name__, subdomain_matching=True) -with open('config/json/main.json') as file: - main_cfg_data = json.loads(file.read()) -app.config['SERVER_NAME'] = f"{main_cfg_data['hosts']['server_name']}:{main_cfg_data['hosts']['port']}" def generate_iq(): @@ -68,17 +67,10 @@ def index(): data = json.loads(file.read()) cols = data['cols'] projects = data['projects'] - return render_template('index.html', random_number=generate_iq(), projects=projects, texlink=f"{main_cfg_data['hosts']['texlink']}:{main_cfg_data['hosts']['texport']}") + return render_template('index.html', random_number=generate_iq(), projects=projects, + texlink=os.getenv('TEXURL')) @app.route('/', subdomain='tex') def texindex(): return render_template('texindex.html') - - -def main(): - app.run(f"{main_cfg_data['hosts']['host']}", f"{main_cfg_data['hosts']['host_port']}") - - -if __name__ == '__main__': - main() diff --git a/static/assets/css/fonts.css b/app/static/assets/css/fonts.css similarity index 100% rename from static/assets/css/fonts.css rename to app/static/assets/css/fonts.css diff --git a/static/assets/css/style.css b/app/static/assets/css/style.css similarity index 100% rename from static/assets/css/style.css rename to app/static/assets/css/style.css diff --git a/static/assets/css/teststyle.css b/app/static/assets/css/teststyle.css similarity index 100% rename from static/assets/css/teststyle.css rename to app/static/assets/css/teststyle.css diff --git a/static/assets/images/chatmanager.png b/app/static/assets/images/chatmanager.png similarity index 100% rename from static/assets/images/chatmanager.png rename to app/static/assets/images/chatmanager.png diff --git a/static/assets/images/soon.jpg b/app/static/assets/images/soon.jpg similarity index 100% rename from static/assets/images/soon.jpg rename to app/static/assets/images/soon.jpg diff --git a/static/assets/images/thissite.png b/app/static/assets/images/thissite.png similarity index 100% rename from static/assets/images/thissite.png rename to app/static/assets/images/thissite.png diff --git a/static/js/projects.js b/app/static/js/projects.js similarity index 100% rename from static/js/projects.js rename to app/static/js/projects.js diff --git a/templates/index.html b/app/templates/index.html similarity index 94% rename from templates/index.html rename to app/templates/index.html index 69ed550..7dedacb 100644 --- a/templates/index.html +++ b/app/templates/index.html @@ -12,7 +12,7 @@

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

Ваш IQ: {{ random_number }}

-