Migration
This commit is contained in:
		
							
								
								
									
										37
									
								
								main.py
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								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__':
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,29 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="ru">
 | 
			
		||||
    <head>
 | 
			
		||||
        <link rel="stylesheet" href="static/assets/css/fonts.css">
 | 
			
		||||
        <link rel="stylesheet" href="static/assets/css/style.css">
 | 
			
		||||
        <link rel="stylesheet" href="{{ url_for('static', filename='assets/css/fonts.css') }}">
 | 
			
		||||
        <link rel="stylesheet" href="{{ url_for('static', filename='assets/css/style.css') }}">
 | 
			
		||||
        <title>thematdev</title>
 | 
			
		||||
    </head>
 | 
			
		||||
    <body>
 | 
			
		||||
        <div class="pagehead">
 | 
			
		||||
            <h1 class="mainh">thematdev</h1>
 | 
			
		||||
            <div class="pagehead-inner">
 | 
			
		||||
                <h1 class="mainh">thematdev</h1>
 | 
			
		||||
                <p> Тут можно подпись какую-то сделать </p>
 | 
			
		||||
                <p> Ваш IQ: {{ random_number }}</p>
 | 
			
		||||
                <div class="btn-container">
 | 
			
		||||
                    <button onclick="location.href='http://tex.thematdev.local:22837'" type="button" class="btn-tex">
 | 
			
		||||
                        <p> TeX </p>
 | 
			
		||||
                    </button>
 | 
			
		||||
                    <button type="button">
 | 
			
		||||
                        Wiki
 | 
			
		||||
                    </button>
 | 
			
		||||
                    <button onclick="location.href='https://t.me/thematdev'" type="button">
 | 
			
		||||
                        TG
 | 
			
		||||
                    </button>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </body>
 | 
			
		||||
    Идея про Гауссово распределение вместо обычного рандома: <a href="https://t.me/Prentor">Prentor</a> и <a href="https://t.me/pavel_the_best"> pavel_the_best </a>
 | 
			
		||||
</html>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								templates/texindex.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								templates/texindex.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html>
 | 
			
		||||
<head>
 | 
			
		||||
</head>
 | 
			
		||||
<body>
 | 
			
		||||
    
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
		Reference in New Issue
	
	Block a user