Пожилой код-ревью
This commit is contained in:
		
							
								
								
									
										8
									
								
								config/json/main.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								config/json/main.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
{
 | 
			
		||||
    "hosts": {
 | 
			
		||||
        "server_name": "thematdev.org",
 | 
			
		||||
        "port": "1488",
 | 
			
		||||
        "texlink": "tex.thematdev.org",
 | 
			
		||||
        "texport": "1488"
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										42
									
								
								main.py
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								main.py
									
									
									
									
									
								
							@@ -4,9 +4,44 @@ import json
 | 
			
		||||
import numpy.random as gaussian_rnd
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
"""..                           ..,.,,,. .                         .  .
 | 
			
		||||
 . .  .......        ...,%&%/,..    .... .*#&&%*...   ....   .    .     .. ..
 | 
			
		||||
..    .. ,.. . ...,(&%   ,........,..,.  ... .. .*#%/..,. ..  ....,.  .... . ...
 | 
			
		||||
, .. .. ... ..  /%*. ...   .... ., ........ ..., . ,.#%#.   ...,.. .    ,.,   ,,
 | 
			
		||||
..... ...  ..*%/ ...  .....  ............    .....,. .,.,(* ........,,..,.,..,.
 | 
			
		||||
.........,.*&(. ...     .......... .   ....... ..,/*.,,,. *& .  .....,,....,...,
 | 
			
		||||
.,........,(,..               .         .     ...../*..,. ..%*,...., ......... .
 | 
			
		||||
*.  .... (%,                       *#.,.,,,,#%  .**(#.,,,./&.%, .... .... ......
 | 
			
		||||
,....... (%                       .#.,,*#*,,,%   ,*.#,,,,,#%.#%   ..  .,.,..,..
 | 
			
		||||
 ...... /@&                         *#&%%%&(,   ./   .,/.   .#%       ..,   ....
 | 
			
		||||
  . . .%@@%.             *@%*,**,,**,,,,..,,,....*.,.//*%#/(,@.
 | 
			
		||||
    .%@@@@@(               .*#%%&%@%%&%%&(%#&@##@%*(%(/,..*%@#
 | 
			
		||||
     (@@@@&(&,                  /&#.,,,,...,,,,*,,***,,.&@#%.
 | 
			
		||||
     (@@@@&. /@*                    /%#*.,*..%       &&##@#
 | 
			
		||||
     (@@@@&(,  *&#.                    .*///(%       @@#.
 | 
			
		||||
    .%@@@@@@@(   .(%#/                      ,%       &%               *(/.
 | 
			
		||||
    ,@@@@@@@@@%,      /##%**,              ,(%.      &/         .(% ..#/(**.
 | 
			
		||||
    ,@@@@@@@@@@@/             .,,,,,,,,,,.  *%       &/        *%@&@%(,*&&&&%
 | 
			
		||||
    ,@@@@@@@@@@@@@*                      ,@(            @@@%..  ,@@&@@..#&*#&,
 | 
			
		||||
    ,@@@@@@%@@@@@@%                    ,&#                *##(**      .#%@&#@&/
 | 
			
		||||
    ,@@@@@@@@@@@@@@&/.                 @@/                *&.         .&@@@@@@%.
 | 
			
		||||
    ,@@@@@@@@@@@@@@@@@@&#(*,           (@/                ,&          #@@@@@@@@@
 | 
			
		||||
    ,@@@@@%.%@@@@@@@@@@@@@@@@@@@/       .#&             ,@@.          &@@@@@@.
 | 
			
		||||
    ,@@@@@%      ,&@@@@@@@@@@@@@@@@@@@&(&@@@@@#(///*/%##              &@@@@@@
 | 
			
		||||
    ,@@@@@%       .&@@@@@@&%&@@@@@@@@@@@@@@@@@@@@/                    &@@@@@&
 | 
			
		||||
    ,@@@@@#         ,&@@@@@#    ,(#&@@@@@@@@@@@@@@@@&**.              &@@@@@&
 | 
			
		||||
    ,@@@@@*          .@@@@@@%.      ,@@@@@@@@@@@@@@@@@@@@@@#..       ,@@@@@@*
 | 
			
		||||
    *@@@@@,            (@@@@@@/     @@@@@@@@@./%&@@@@@@@@@@@@@@@@@%*,(@@@@@@,
 | 
			
		||||
    ,@@@@@,             .(@@@@@&/ ,@@@@@@@&.        ..,(@@@@@@@@@@@@@@@@@@@@.
 | 
			
		||||
    #@@@@@,              .(@@@@@&#@@@@@@@&*                .((%%@@@@@@@@@@@&.
 | 
			
		||||
    #@@@@&.                .&@@@@@@@@@@@#.                       .,*%&@@@@@%
 | 
			
		||||
    #@@@@&.                  (@@@@@@@@@                                   **    """
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
app = Flask(__name__, subdomain_matching=True)
 | 
			
		||||
app.config['SERVER_NAME'] = 'thematdev.org:1488'
 | 
			
		||||
SOCKET = 'thematdev.org:1488'
 | 
			
		||||
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():
 | 
			
		||||
@@ -33,8 +68,7 @@ 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"tex.{SOCKET}")
 | 
			
		||||
    return render_template('index.html', random_number=generate_iq(), projects=projects, texlink=f"{main_cfg_data['hosts']['texlink']}:{main_cfg_data['hosts']['texport']}")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@app.route('/', subdomain='tex')
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@
 | 
			
		||||
                <p> Тут можно подпись какую-то сделать </p>
 | 
			
		||||
                <p> Ваш IQ: {{ random_number }}</p>
 | 
			
		||||
                <div class="btn-container">
 | 
			
		||||
                    <button onclick="location.href='http://{{texlink}}'" type="button" class="btn-tex">
 | 
			
		||||
                    <button onclick="location.href='https://{{texlink}}'" type="button" class="btn-tex">
 | 
			
		||||
                        <p> TeX </p>
 | 
			
		||||
                    </button>
 | 
			
		||||
                    <button type="button">
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user