Порядок: дубль удалён, папки названы по содержанию
«WEB. HTML 2» повторял «WEB. HTML flask-wtf» (отличались только два маршрута) — оставлена более поздняя версия. Папки: 01-flask-html, 02-flask-wtf-forms, 03-yandex-maps-search. Переводы строк приведены к LF.
3
.gitattributes
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
* text=auto eol=lf
|
||||
*.png binary
|
||||
*.jpg binary
|
||||
|
|
@ -1,273 +1,273 @@
|
|||
from flask import Flask, url_for, request
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return "Миссия Колонизация Марса"
|
||||
|
||||
|
||||
@app.route('/index')
|
||||
def gimn():
|
||||
return 'И на Марсе будут яблони цвести!'
|
||||
|
||||
|
||||
@app.route('/promotion')
|
||||
def promo():
|
||||
return '</br>'.join(['Человечество вырастает из детства.',
|
||||
'Человечеству мала одна планета.',
|
||||
'Мы сделаем обитаемыми безжизненные пока планеты.',
|
||||
'И начнем с Марса!', 'Присоединяйся!'])
|
||||
|
||||
|
||||
@app.route('/image_mars')
|
||||
def img():
|
||||
return f"""<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Привет, Марс!</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Жди нас, Марс!</h1>
|
||||
<img src="{url_for('static', filename='img/planet.jpg')}"></br>
|
||||
<a>Вот она какая, красная планета.</a>
|
||||
</body>
|
||||
</html>"""
|
||||
|
||||
|
||||
@app.route('/promotion_image')
|
||||
def promo_img():
|
||||
return f"""<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="{url_for('static', filename='css/style.css')}" />
|
||||
<title>Колонизация</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="red" >Жди нас, Марс!</h1>
|
||||
<img src="{url_for('static', filename='img/planet.jpg')}"></br>
|
||||
<div class="font black"><b>Человечество вырастает из детства.</b></div></br>
|
||||
<div class="font green"><b>Человечеству мала одна планета.</b></div></br>
|
||||
<div class="font gray"><b>Мы сделаем обитаемыми безжизненные пока планеты.</b></div></br>
|
||||
<div class="font yellow"><b>И начнем с Марса!</b></div></br>
|
||||
<div class="font red"><b>Присоединяйся!</b></div>
|
||||
</body>
|
||||
</html>"""
|
||||
|
||||
|
||||
@app.route('/astronaut_selection', methods=['POST', 'GET'])
|
||||
def form_sample():
|
||||
if request.method == 'GET':
|
||||
return f'''<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<link rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css"
|
||||
integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1"
|
||||
crossorigin="anonymous">
|
||||
<link rel="stylesheet" type="text/css" href="{url_for('static', filename='css/style.css')}" />
|
||||
<title>Отбор астронавтов</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1 style="text-align:center">Анкета претендента</h1>
|
||||
<h2 style="text-align:center">на участие в миссии</h2>
|
||||
<div>
|
||||
<form class="login_form" method="post">
|
||||
<input type="text" class="form-control" id="text" placeholder="Введите фамилию" name="text1">
|
||||
<input type="text" class="form-control" id="text" placeholder="Введите имя" name="text2"></br>
|
||||
<input type="email" class="form-control" id="email" aria-describedby="emailHelp" placeholder="Введите адрес почты" name="email">
|
||||
<div class="form-group">
|
||||
<label for="classSelect">Какое у Вас образование?</label>
|
||||
<select class="form-control" id="classSelect" name="class">
|
||||
<option>Начальное</option>
|
||||
<option>Среднее оконченное</option>
|
||||
<option>Среднее неоконченное</option>
|
||||
<option>Высшее оконченное</option>
|
||||
<option>Высшее неоконченное</option>
|
||||
</select>
|
||||
</div></br>
|
||||
<label for="classSelect">Какие у Вас есть профессии?</label>
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" id="acceptRules" name="accept1">
|
||||
<label class="form-check-label" for="acceptRules">Инженер-исследователь</label></br>
|
||||
<input type="checkbox" class="form-check-input" id="acceptRules" name="accept2">
|
||||
<label class="form-check-label" for="acceptRules">Инженер-строитель</label></br>
|
||||
<input type="checkbox" class="form-check-input" id="acceptRules" name="accept3">
|
||||
<label class="form-check-label" for="acceptRules">Пилот</label></br>
|
||||
<input type="checkbox" class="form-check-input" id="acceptRules" name="accept4">
|
||||
<label class="form-check-label" for="acceptRules">Метеоролог</label></br>
|
||||
<input type="checkbox" class="form-check-input" id="acceptRules" name="accept5">
|
||||
<label class="form-check-label" for="acceptRules">Инженер по жизнеобеспечению</label></br>
|
||||
<input type="checkbox" class="form-check-input" id="acceptRules" name="accept6">
|
||||
<label class="form-check-label" for="acceptRules">Инженер по радиационной защите</label></br>
|
||||
<input type="checkbox" class="form-check-input" id="acceptRules" name="accept7">
|
||||
<label class="form-check-label" for="acceptRules">Врач</label></br>
|
||||
<input type="checkbox" class="form-check-input" id="acceptRules" name="accept8">
|
||||
<label class="form-check-label" for="acceptRules">Экзобиолог</label></br>
|
||||
</div></br>
|
||||
<div class="form-group">
|
||||
<label for="form-check">Укажите пол</label>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="sex" id="male" value="male">
|
||||
<label class="form-check-label" for="male">
|
||||
Мужской
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="sex" id="female" value="female">
|
||||
<label class="form-check-label" for="female">
|
||||
Женский
|
||||
</label>
|
||||
</div>
|
||||
</div></br>
|
||||
<div class="form-group">
|
||||
<label for="about">Почему Вы хотите принять участие в миссии?</label>
|
||||
<textarea class="form-control" id="about" rows="3" name="about"></textarea>
|
||||
</div></br>
|
||||
<div class="form-group">
|
||||
<label for="photo">Приложите фотографию</label></br>
|
||||
<input type="file" class="form-control-file" id="photo" name="file">
|
||||
</div></br>
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" id="acceptRules" name="accept">
|
||||
<label class="form-check-label" for="acceptRules">Готовы остаться на Марсе?</label>
|
||||
</div></br>
|
||||
<button type="submit" class="btn btn-primary">Отправить</button>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>'''
|
||||
elif request.method == 'POST':
|
||||
print("Фамилия -", request.form.get('text1'))
|
||||
print("Имя -", request.form.get('text2'))
|
||||
print("Почта -", request.form.get('email'))
|
||||
print("Образование -", request.form.get('class'))
|
||||
prof = []
|
||||
typis = {'accept1': "Инженер-исследователь", 'accept2': "Инженер-строитель", 'accept3': "Пилот",
|
||||
'accept4': "Метеоролог", 'accept5': 'Инженер по жизнеобеспечению',
|
||||
'accept6': 'Инженер по радиационной защите', 'accept7': "Врач", 'accept8': "Экзобиолог"}
|
||||
for i in typis:
|
||||
a = request.form.get(i)
|
||||
if a:
|
||||
prof.append(typis[i])
|
||||
print("Профкссия(-и):", ", ".join(prof))
|
||||
print("Пол -", request.form.get('sex'))
|
||||
print("Причины участия -", request.form.get('about'))
|
||||
print("Фото -", request.form.get('file'))
|
||||
if request.form.get('accept'):
|
||||
print("Подписан на программу")
|
||||
else:
|
||||
print("Отказался от программы")
|
||||
return "Форма отправлена"
|
||||
|
||||
|
||||
@app.route('/choice/<planet_name>')
|
||||
def choice(planet_name):
|
||||
return f"""<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="{url_for('static', filename='css/style.css')}" />
|
||||
<title>Колонизация</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="font">Моё предложение: {planet_name}</h1>
|
||||
<h1>Эта планета близка к Земле;</h1>
|
||||
<div class="font green"><b>На ней много необходимых ресурсов;</b></div></br>
|
||||
<div class="font gray"><b>На ней есть вода и атмосфера;</b></div></br>
|
||||
<div class="font yellow"><b>На ней есть небольшое магнитное поле;</b></div></br>
|
||||
<div class="font red"><b>Наконец, она просто красива!</b></div></br>
|
||||
</body>
|
||||
</html>"""
|
||||
|
||||
|
||||
@app.route('/results/<nickname>/<int:level>/<float:rating>')
|
||||
def result(nickname, level, rating):
|
||||
return f"""<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="{url_for('static', filename='css/style.css')}" />
|
||||
<title>Колонизация</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="font">Результаты отбора</h1>
|
||||
<h1>Претендента на участие в миссии {nickname}:</h1>
|
||||
<div class="font green"><b>Поздравляем! Ваш рейтинг после {level} этапа отбора</b></div>
|
||||
<h1>составляет {rating}!</h1>
|
||||
<div class="font yellow"><b>Желаем удачи!</b></div></br>
|
||||
</body>
|
||||
</html>"""
|
||||
|
||||
|
||||
@app.route('/load_photo', methods=['POST', 'GET'])
|
||||
def photo():
|
||||
if request.method == 'GET':
|
||||
return f'''<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<link rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css"
|
||||
integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1"
|
||||
crossorigin="anonymous">
|
||||
<link rel="stylesheet" type="text/css" href="{url_for('static', filename='css/style.css')}" />
|
||||
<title>Отбор астронавтов</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1 style="text-align:center">Загрузка фотографии</h1>
|
||||
<h2 style="text-align:center">для участия в миссии</h2>
|
||||
<div>
|
||||
<form class="login_form" method="post" enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
<label for="photo">Приложите фотографию</label></br>
|
||||
<input type="file" class="form-control-file" id="photo" name="file">
|
||||
</div></br>
|
||||
<img class="width" src="{url_for('static', filename='img/img.png')}"></br>
|
||||
<button type="submit" class="btn btn-primary">Отправить</button>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>'''
|
||||
elif request.method == 'POST':
|
||||
f = request.files['file']
|
||||
if f:
|
||||
with open("static/img/img.png", "wb") as file:
|
||||
file.write(f.read())
|
||||
return f'''<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<link rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css"
|
||||
integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1"
|
||||
crossorigin="anonymous">
|
||||
<link rel="stylesheet" type="text/css" href="{url_for('static', filename='css/style.css')}" />
|
||||
<title>Отбор астронавтов</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1 style="text-align:center">Загрузка фотографии</h1>
|
||||
<h2 style="text-align:center">для участия в миссии</h2>
|
||||
<div>
|
||||
<form class="login_form" method="post" enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
<label for="photo">Приложите фотографию</label></br>
|
||||
<input type="file" class="form-control-file" id="photo" name="file">
|
||||
</div></br>
|
||||
<img class="width" src="{url_for('static', filename='img/img.png')}"></br>
|
||||
<button type="submit" class="btn btn-primary">Отправить</button>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>'''
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(port=8080, host='127.0.0.1')
|
||||
from flask import Flask, url_for, request
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return "Миссия Колонизация Марса"
|
||||
|
||||
|
||||
@app.route('/index')
|
||||
def gimn():
|
||||
return 'И на Марсе будут яблони цвести!'
|
||||
|
||||
|
||||
@app.route('/promotion')
|
||||
def promo():
|
||||
return '</br>'.join(['Человечество вырастает из детства.',
|
||||
'Человечеству мала одна планета.',
|
||||
'Мы сделаем обитаемыми безжизненные пока планеты.',
|
||||
'И начнем с Марса!', 'Присоединяйся!'])
|
||||
|
||||
|
||||
@app.route('/image_mars')
|
||||
def img():
|
||||
return f"""<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Привет, Марс!</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Жди нас, Марс!</h1>
|
||||
<img src="{url_for('static', filename='img/planet.jpg')}"></br>
|
||||
<a>Вот она какая, красная планета.</a>
|
||||
</body>
|
||||
</html>"""
|
||||
|
||||
|
||||
@app.route('/promotion_image')
|
||||
def promo_img():
|
||||
return f"""<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="{url_for('static', filename='css/style.css')}" />
|
||||
<title>Колонизация</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="red" >Жди нас, Марс!</h1>
|
||||
<img src="{url_for('static', filename='img/planet.jpg')}"></br>
|
||||
<div class="font black"><b>Человечество вырастает из детства.</b></div></br>
|
||||
<div class="font green"><b>Человечеству мала одна планета.</b></div></br>
|
||||
<div class="font gray"><b>Мы сделаем обитаемыми безжизненные пока планеты.</b></div></br>
|
||||
<div class="font yellow"><b>И начнем с Марса!</b></div></br>
|
||||
<div class="font red"><b>Присоединяйся!</b></div>
|
||||
</body>
|
||||
</html>"""
|
||||
|
||||
|
||||
@app.route('/astronaut_selection', methods=['POST', 'GET'])
|
||||
def form_sample():
|
||||
if request.method == 'GET':
|
||||
return f'''<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<link rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css"
|
||||
integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1"
|
||||
crossorigin="anonymous">
|
||||
<link rel="stylesheet" type="text/css" href="{url_for('static', filename='css/style.css')}" />
|
||||
<title>Отбор астронавтов</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1 style="text-align:center">Анкета претендента</h1>
|
||||
<h2 style="text-align:center">на участие в миссии</h2>
|
||||
<div>
|
||||
<form class="login_form" method="post">
|
||||
<input type="text" class="form-control" id="text" placeholder="Введите фамилию" name="text1">
|
||||
<input type="text" class="form-control" id="text" placeholder="Введите имя" name="text2"></br>
|
||||
<input type="email" class="form-control" id="email" aria-describedby="emailHelp" placeholder="Введите адрес почты" name="email">
|
||||
<div class="form-group">
|
||||
<label for="classSelect">Какое у Вас образование?</label>
|
||||
<select class="form-control" id="classSelect" name="class">
|
||||
<option>Начальное</option>
|
||||
<option>Среднее оконченное</option>
|
||||
<option>Среднее неоконченное</option>
|
||||
<option>Высшее оконченное</option>
|
||||
<option>Высшее неоконченное</option>
|
||||
</select>
|
||||
</div></br>
|
||||
<label for="classSelect">Какие у Вас есть профессии?</label>
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" id="acceptRules" name="accept1">
|
||||
<label class="form-check-label" for="acceptRules">Инженер-исследователь</label></br>
|
||||
<input type="checkbox" class="form-check-input" id="acceptRules" name="accept2">
|
||||
<label class="form-check-label" for="acceptRules">Инженер-строитель</label></br>
|
||||
<input type="checkbox" class="form-check-input" id="acceptRules" name="accept3">
|
||||
<label class="form-check-label" for="acceptRules">Пилот</label></br>
|
||||
<input type="checkbox" class="form-check-input" id="acceptRules" name="accept4">
|
||||
<label class="form-check-label" for="acceptRules">Метеоролог</label></br>
|
||||
<input type="checkbox" class="form-check-input" id="acceptRules" name="accept5">
|
||||
<label class="form-check-label" for="acceptRules">Инженер по жизнеобеспечению</label></br>
|
||||
<input type="checkbox" class="form-check-input" id="acceptRules" name="accept6">
|
||||
<label class="form-check-label" for="acceptRules">Инженер по радиационной защите</label></br>
|
||||
<input type="checkbox" class="form-check-input" id="acceptRules" name="accept7">
|
||||
<label class="form-check-label" for="acceptRules">Врач</label></br>
|
||||
<input type="checkbox" class="form-check-input" id="acceptRules" name="accept8">
|
||||
<label class="form-check-label" for="acceptRules">Экзобиолог</label></br>
|
||||
</div></br>
|
||||
<div class="form-group">
|
||||
<label for="form-check">Укажите пол</label>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="sex" id="male" value="male">
|
||||
<label class="form-check-label" for="male">
|
||||
Мужской
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="sex" id="female" value="female">
|
||||
<label class="form-check-label" for="female">
|
||||
Женский
|
||||
</label>
|
||||
</div>
|
||||
</div></br>
|
||||
<div class="form-group">
|
||||
<label for="about">Почему Вы хотите принять участие в миссии?</label>
|
||||
<textarea class="form-control" id="about" rows="3" name="about"></textarea>
|
||||
</div></br>
|
||||
<div class="form-group">
|
||||
<label for="photo">Приложите фотографию</label></br>
|
||||
<input type="file" class="form-control-file" id="photo" name="file">
|
||||
</div></br>
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" id="acceptRules" name="accept">
|
||||
<label class="form-check-label" for="acceptRules">Готовы остаться на Марсе?</label>
|
||||
</div></br>
|
||||
<button type="submit" class="btn btn-primary">Отправить</button>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>'''
|
||||
elif request.method == 'POST':
|
||||
print("Фамилия -", request.form.get('text1'))
|
||||
print("Имя -", request.form.get('text2'))
|
||||
print("Почта -", request.form.get('email'))
|
||||
print("Образование -", request.form.get('class'))
|
||||
prof = []
|
||||
typis = {'accept1': "Инженер-исследователь", 'accept2': "Инженер-строитель", 'accept3': "Пилот",
|
||||
'accept4': "Метеоролог", 'accept5': 'Инженер по жизнеобеспечению',
|
||||
'accept6': 'Инженер по радиационной защите', 'accept7': "Врач", 'accept8': "Экзобиолог"}
|
||||
for i in typis:
|
||||
a = request.form.get(i)
|
||||
if a:
|
||||
prof.append(typis[i])
|
||||
print("Профкссия(-и):", ", ".join(prof))
|
||||
print("Пол -", request.form.get('sex'))
|
||||
print("Причины участия -", request.form.get('about'))
|
||||
print("Фото -", request.form.get('file'))
|
||||
if request.form.get('accept'):
|
||||
print("Подписан на программу")
|
||||
else:
|
||||
print("Отказался от программы")
|
||||
return "Форма отправлена"
|
||||
|
||||
|
||||
@app.route('/choice/<planet_name>')
|
||||
def choice(planet_name):
|
||||
return f"""<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="{url_for('static', filename='css/style.css')}" />
|
||||
<title>Колонизация</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="font">Моё предложение: {planet_name}</h1>
|
||||
<h1>Эта планета близка к Земле;</h1>
|
||||
<div class="font green"><b>На ней много необходимых ресурсов;</b></div></br>
|
||||
<div class="font gray"><b>На ней есть вода и атмосфера;</b></div></br>
|
||||
<div class="font yellow"><b>На ней есть небольшое магнитное поле;</b></div></br>
|
||||
<div class="font red"><b>Наконец, она просто красива!</b></div></br>
|
||||
</body>
|
||||
</html>"""
|
||||
|
||||
|
||||
@app.route('/results/<nickname>/<int:level>/<float:rating>')
|
||||
def result(nickname, level, rating):
|
||||
return f"""<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="{url_for('static', filename='css/style.css')}" />
|
||||
<title>Колонизация</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="font">Результаты отбора</h1>
|
||||
<h1>Претендента на участие в миссии {nickname}:</h1>
|
||||
<div class="font green"><b>Поздравляем! Ваш рейтинг после {level} этапа отбора</b></div>
|
||||
<h1>составляет {rating}!</h1>
|
||||
<div class="font yellow"><b>Желаем удачи!</b></div></br>
|
||||
</body>
|
||||
</html>"""
|
||||
|
||||
|
||||
@app.route('/load_photo', methods=['POST', 'GET'])
|
||||
def photo():
|
||||
if request.method == 'GET':
|
||||
return f'''<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<link rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css"
|
||||
integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1"
|
||||
crossorigin="anonymous">
|
||||
<link rel="stylesheet" type="text/css" href="{url_for('static', filename='css/style.css')}" />
|
||||
<title>Отбор астронавтов</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1 style="text-align:center">Загрузка фотографии</h1>
|
||||
<h2 style="text-align:center">для участия в миссии</h2>
|
||||
<div>
|
||||
<form class="login_form" method="post" enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
<label for="photo">Приложите фотографию</label></br>
|
||||
<input type="file" class="form-control-file" id="photo" name="file">
|
||||
</div></br>
|
||||
<img class="width" src="{url_for('static', filename='img/img.png')}"></br>
|
||||
<button type="submit" class="btn btn-primary">Отправить</button>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>'''
|
||||
elif request.method == 'POST':
|
||||
f = request.files['file']
|
||||
if f:
|
||||
with open("static/img/img.png", "wb") as file:
|
||||
file.write(f.read())
|
||||
return f'''<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<link rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css"
|
||||
integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1"
|
||||
crossorigin="anonymous">
|
||||
<link rel="stylesheet" type="text/css" href="{url_for('static', filename='css/style.css')}" />
|
||||
<title>Отбор астронавтов</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1 style="text-align:center">Загрузка фотографии</h1>
|
||||
<h2 style="text-align:center">для участия в миссии</h2>
|
||||
<div>
|
||||
<form class="login_form" method="post" enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
<label for="photo">Приложите фотографию</label></br>
|
||||
<input type="file" class="form-control-file" id="photo" name="file">
|
||||
</div></br>
|
||||
<img class="width" src="{url_for('static', filename='img/img.png')}"></br>
|
||||
<button type="submit" class="btn btn-primary">Отправить</button>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>'''
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(port=8080, host='127.0.0.1')
|
||||
|
|
@ -1,54 +1,54 @@
|
|||
h1.red {
|
||||
color: #d22e3a;
|
||||
}
|
||||
|
||||
h1.font {
|
||||
font-size: 36px;
|
||||
}
|
||||
|
||||
img.width {
|
||||
width: 430px;
|
||||
}
|
||||
|
||||
form.login_form {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
max-width: 450px;
|
||||
background-color: #ffdcbb;
|
||||
border: 1px solid gray;
|
||||
border-radius: 5px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
div.font {
|
||||
font-size: 20px;
|
||||
width: 600px;
|
||||
height: 40px;
|
||||
text-align: left;
|
||||
line-height: 50px;
|
||||
}
|
||||
|
||||
div.red {
|
||||
color: #6b1c29;
|
||||
background-color: #f7d7dc;
|
||||
}
|
||||
|
||||
div.black {
|
||||
color: #000000;
|
||||
background-color: #d6d9d9;
|
||||
}
|
||||
|
||||
div.green {
|
||||
color: #185921;
|
||||
background-color: #d3eedc;
|
||||
}
|
||||
|
||||
div.gray {
|
||||
color: #393c42;
|
||||
background-color: #e1e3e4;
|
||||
}
|
||||
|
||||
div.yellow {
|
||||
color: #845900;
|
||||
background-color: #fff3ce;
|
||||
h1.red {
|
||||
color: #d22e3a;
|
||||
}
|
||||
|
||||
h1.font {
|
||||
font-size: 36px;
|
||||
}
|
||||
|
||||
img.width {
|
||||
width: 430px;
|
||||
}
|
||||
|
||||
form.login_form {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
max-width: 450px;
|
||||
background-color: #ffdcbb;
|
||||
border: 1px solid gray;
|
||||
border-radius: 5px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
div.font {
|
||||
font-size: 20px;
|
||||
width: 600px;
|
||||
height: 40px;
|
||||
text-align: left;
|
||||
line-height: 50px;
|
||||
}
|
||||
|
||||
div.red {
|
||||
color: #6b1c29;
|
||||
background-color: #f7d7dc;
|
||||
}
|
||||
|
||||
div.black {
|
||||
color: #000000;
|
||||
background-color: #d6d9d9;
|
||||
}
|
||||
|
||||
div.green {
|
||||
color: #185921;
|
||||
background-color: #d3eedc;
|
||||
}
|
||||
|
||||
div.gray {
|
||||
color: #393c42;
|
||||
background-color: #e1e3e4;
|
||||
}
|
||||
|
||||
div.yellow {
|
||||
color: #845900;
|
||||
background-color: #fff3ce;
|
||||
}
|
||||
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 422 KiB After Width: | Height: | Size: 422 KiB |
|
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 77 KiB |
|
|
@ -1,16 +1,16 @@
|
|||
{
|
||||
"news": [
|
||||
{
|
||||
"title": "Сегодня хорошая погода",
|
||||
"content": "Невероятно, сегодня хорошая погода"
|
||||
},
|
||||
{
|
||||
"title": "Завтра хорошая погода",
|
||||
"content": "С ума сойти, и завтра хорошая погода"
|
||||
},
|
||||
{
|
||||
"title": "Послезавтра дождь",
|
||||
"content": "Все вошло в норму"
|
||||
}
|
||||
]
|
||||
{
|
||||
"news": [
|
||||
{
|
||||
"title": "Сегодня хорошая погода",
|
||||
"content": "Невероятно, сегодня хорошая погода"
|
||||
},
|
||||
{
|
||||
"title": "Завтра хорошая погода",
|
||||
"content": "С ума сойти, и завтра хорошая погода"
|
||||
},
|
||||
{
|
||||
"title": "Послезавтра дождь",
|
||||
"content": "Все вошло в норму"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
h4.color_edit {
|
||||
color: "black";
|
||||
}
|
||||
|
||||
p.padmarging {
|
||||
margin-left: 20px;
|
||||
h4.color_edit {
|
||||
color: "black";
|
||||
}
|
||||
|
||||
p.padmarging {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
Before Width: | Height: | Size: 268 KiB After Width: | Height: | Size: 268 KiB |
|
Before Width: | Height: | Size: 267 KiB After Width: | Height: | Size: 267 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
|
@ -1,15 +1,15 @@
|
|||
{% extends "base_two.html" %}
|
||||
|
||||
{% block content1 %}
|
||||
<div class="alert alert-light" role="alert">
|
||||
<h4><font color="#DCDCDC">И на Марсе будут яблони цвести!</font></h4>
|
||||
</div>
|
||||
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Фамилия: {{surname}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Имя: {{name}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Образование: {{education}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Профессия: {{profession}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Пол: {{sex}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Мотивация: {{motivation}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Готовы остаться на Марсе? {{ready}}</p></h4>
|
||||
{% extends "base_two.html" %}
|
||||
|
||||
{% block content1 %}
|
||||
<div class="alert alert-light" role="alert">
|
||||
<h4><font color="#DCDCDC">И на Марсе будут яблони цвести!</font></h4>
|
||||
</div>
|
||||
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Фамилия: {{surname}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Имя: {{name}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Образование: {{education}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Профессия: {{profession}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Пол: {{sex}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Мотивация: {{motivation}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Готовы остаться на Марсе? {{ready}}</p></h4>
|
||||
{% endblock %}
|
||||
|
|
@ -1,32 +1,32 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!-- Required meta tags -->
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<!-- Bootstrap CSS -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
|
||||
rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"
|
||||
crossorigin="anonymous">
|
||||
|
||||
<!-- <link rel="stylesheet" type="text/css" href="static/css/style.css" /> -->
|
||||
<title>{{title}}</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar navbar-light bg-light">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand mb-0" href="#"><h1>Миссия Колонизация Марса</h1></a>
|
||||
<div class="navbar-text mb-0 h5">
|
||||
Mars One
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<!-- Begin page content -->
|
||||
<main role="main" class="container-fluid">
|
||||
{% block content1 %}{% endblock %}
|
||||
</main>
|
||||
</body>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!-- Required meta tags -->
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<!-- Bootstrap CSS -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
|
||||
rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"
|
||||
crossorigin="anonymous">
|
||||
|
||||
<!-- <link rel="stylesheet" type="text/css" href="static/css/style.css" /> -->
|
||||
<title>{{title}}</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar navbar-light bg-light">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand mb-0" href="#"><h1>Миссия Колонизация Марса</h1></a>
|
||||
<div class="navbar-text mb-0 h5">
|
||||
Mars One
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<!-- Begin page content -->
|
||||
<main role="main" class="container-fluid">
|
||||
{% block content1 %}{% endblock %}
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content1 %}
|
||||
<div class="alert alert-light" role="alert">
|
||||
<h4><font color="#DCDCDC">И на Марсе будут яблони цвести!</font></h4>
|
||||
</div>
|
||||
<div class="container">
|
||||
{% block content2 %}{% endblock %}
|
||||
</div>
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content1 %}
|
||||
<div class="alert alert-light" role="alert">
|
||||
<h4><font color="#DCDCDC">И на Марсе будут яблони цвести!</font></h4>
|
||||
</div>
|
||||
<div class="container">
|
||||
{% block content2 %}{% endblock %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
{% extends "base_two.html" %}
|
||||
|
||||
{% block content2 %}
|
||||
<h1 align="center">Размещение по каютам</h1>
|
||||
{% for user in users %}
|
||||
<h3>{{ user }} - Каюта № {{ loop.index }} {% if loop.first %} - первый в очереди {% endif %}</h3>
|
||||
{% endfor %}
|
||||
{% extends "base_two.html" %}
|
||||
|
||||
{% block content2 %}
|
||||
<h1 align="center">Размещение по каютам</h1>
|
||||
{% for user in users %}
|
||||
<h3>{{ user }} - Каюта № {{ loop.index }} {% if loop.first %} - первый в очереди {% endif %}</h3>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content1 %}
|
||||
<h4>{{label}}</h4>
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content1 %}
|
||||
<h4>{{label}}</h4>
|
||||
{% endblock %}
|
||||
|
|
@ -1,27 +1,27 @@
|
|||
{% extends "base_two.html" %}
|
||||
|
||||
{% block content2 %}
|
||||
{% set all_prof = ['врач', "экзобиолог", "климатолог", "астрогеолог", "гляциолог", "метеоролог",
|
||||
'инженер-исследователь', "пилот", "строитель", "инженер по терраформированию",
|
||||
"специалист по радиационной защите", "инженер жизнеобеспечения", "оператор марсохода",
|
||||
"киберинженер", "штурман", "пилот дронов"] %}
|
||||
{% if var == "ol" %}
|
||||
<p class="h1">Список профессий</p>
|
||||
<div class="container">
|
||||
<ol>
|
||||
{% for p in all_prof %}
|
||||
<li class="h5">{{p}}</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
</div>
|
||||
{% elif var == "ul" %}
|
||||
<p class="h1">Список профессий</p>
|
||||
<div class="container">
|
||||
{% for p in all_prof %}
|
||||
<li class="h5">{{p}}</li>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="h1">Индекс указан неправильно!</p>
|
||||
{% endif %}
|
||||
{% extends "base_two.html" %}
|
||||
|
||||
{% block content2 %}
|
||||
{% set all_prof = ['врач', "экзобиолог", "климатолог", "астрогеолог", "гляциолог", "метеоролог",
|
||||
'инженер-исследователь', "пилот", "строитель", "инженер по терраформированию",
|
||||
"специалист по радиационной защите", "инженер жизнеобеспечения", "оператор марсохода",
|
||||
"киберинженер", "штурман", "пилот дронов"] %}
|
||||
{% if var == "ol" %}
|
||||
<p class="h1">Список профессий</p>
|
||||
<div class="container">
|
||||
<ol>
|
||||
{% for p in all_prof %}
|
||||
<li class="h5">{{p}}</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
</div>
|
||||
{% elif var == "ul" %}
|
||||
<p class="h1">Список профессий</p>
|
||||
<div class="container">
|
||||
{% for p in all_prof %}
|
||||
<li class="h5">{{p}}</li>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="h1">Индекс указан неправильно!</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
@ -1,45 +1,45 @@
|
|||
{% extends "base_two.html" %}
|
||||
|
||||
{% block content2 %}
|
||||
<h1><img src="../static/img/mars_ico.png">Аварийный доступ</h1><br>
|
||||
<form action="" method="post" novalidate>
|
||||
{{ form.hidden_tag() }}
|
||||
<p>
|
||||
<big>{{ form.id_user.label }}</big>><br>
|
||||
{{ form.id_user(class="form-control") }}<br>
|
||||
{% for error in form.id_user.errors %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
<big>{{ form.pas_user.label }}</big><br>
|
||||
{{ form.pas_user(class="form-control", type="password") }}<br>
|
||||
{% for error in form.pas_user.errors %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
<big>{{ form.id_cap.label }}</big><br>
|
||||
{{ form.id_cap(class="form-control") }}<br>
|
||||
{% for error in form.id_cap.errors %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
<big>{{ form.pas_cap.label }}</big><br>
|
||||
{{ form.pas_cap(class="form-control", type="password") }}<br>
|
||||
{% for error in form.pas_cap.errors %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>{{ form.submit(type="submit", class="btn btn-primary") }}</p>
|
||||
</form>
|
||||
{% extends "base_two.html" %}
|
||||
|
||||
{% block content2 %}
|
||||
<h1><img src="../static/img/mars_ico.png">Аварийный доступ</h1><br>
|
||||
<form action="" method="post" novalidate>
|
||||
{{ form.hidden_tag() }}
|
||||
<p>
|
||||
<big>{{ form.id_user.label }}</big>><br>
|
||||
{{ form.id_user(class="form-control") }}<br>
|
||||
{% for error in form.id_user.errors %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
<big>{{ form.pas_user.label }}</big><br>
|
||||
{{ form.pas_user(class="form-control", type="password") }}<br>
|
||||
{% for error in form.pas_user.errors %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
<big>{{ form.id_cap.label }}</big><br>
|
||||
{{ form.id_cap(class="form-control") }}<br>
|
||||
{% for error in form.id_cap.errors %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
<big>{{ form.pas_cap.label }}</big><br>
|
||||
{{ form.pas_cap(class="form-control", type="password") }}<br>
|
||||
{% for error in form.pas_cap.errors %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>{{ form.submit(type="submit", class="btn btn-primary") }}</p>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
|
@ -1,17 +1,17 @@
|
|||
{% extends "base_two.html" %}
|
||||
|
||||
{% block content2 %}
|
||||
{% set sin = ['врач', "экзобиолог", "климатолог", "астрогеолог", "гляциолог", "метеоролог"] %}
|
||||
{% set inj = ['инженер-исследователь', "пилот", "строитель", "инженер по терраформированию",
|
||||
"специалист по радиационной защите", "инженер жизнеобеспечения", "оператор марсохода",
|
||||
"киберинженер", "штурман", "пилот дронов"] %}
|
||||
{% if spec.lower() in sin %}
|
||||
<p class="text-center h2">Научные симуляторы</p>
|
||||
<p class="text-center"><img src="/static/img/kb1.jpg" class="img-fluid"></p>
|
||||
{% elif spec.lower() in inj %}
|
||||
<p class="text-center h2">Инженерные тренажеры</p>
|
||||
<p class="text-center"><img src="/static/img/kb2.jpg" class="img-fluid"></p>
|
||||
{% else %}
|
||||
<p class="text-center h1">В наших списках ваша профессия отсутствует!</p>
|
||||
{% endif %}
|
||||
{% extends "base_two.html" %}
|
||||
|
||||
{% block content2 %}
|
||||
{% set sin = ['врач', "экзобиолог", "климатолог", "астрогеолог", "гляциолог", "метеоролог"] %}
|
||||
{% set inj = ['инженер-исследователь', "пилот", "строитель", "инженер по терраформированию",
|
||||
"специалист по радиационной защите", "инженер жизнеобеспечения", "оператор марсохода",
|
||||
"киберинженер", "штурман", "пилот дронов"] %}
|
||||
{% if spec.lower() in sin %}
|
||||
<p class="text-center h2">Научные симуляторы</p>
|
||||
<p class="text-center"><img src="/static/img/kb1.jpg" class="img-fluid"></p>
|
||||
{% elif spec.lower() in inj %}
|
||||
<p class="text-center h2">Инженерные тренажеры</p>
|
||||
<p class="text-center"><img src="/static/img/kb2.jpg" class="img-fluid"></p>
|
||||
{% else %}
|
||||
<p class="text-center h1">В наших списках ваша профессия отсутствует!</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
@ -1,21 +1,21 @@
|
|||
def delta(org, adr):
|
||||
first = "0.0001"
|
||||
adr = list(map(float, adr.split(',')))
|
||||
|
||||
k1 = float(first)
|
||||
while True:
|
||||
k = adr[0] + k1
|
||||
if org[0] + 0.001 >= k:
|
||||
k1 *= 10
|
||||
else:
|
||||
break
|
||||
|
||||
k2 = float(first)
|
||||
while True:
|
||||
k = adr[1] + k2
|
||||
if org[1] + 0.001 >= k:
|
||||
k2 *= 10
|
||||
else:
|
||||
break
|
||||
|
||||
def delta(org, adr):
|
||||
first = "0.0001"
|
||||
adr = list(map(float, adr.split(',')))
|
||||
|
||||
k1 = float(first)
|
||||
while True:
|
||||
k = adr[0] + k1
|
||||
if org[0] + 0.001 >= k:
|
||||
k1 *= 10
|
||||
else:
|
||||
break
|
||||
|
||||
k2 = float(first)
|
||||
while True:
|
||||
k = adr[1] + k2
|
||||
if org[1] + 0.001 >= k:
|
||||
k2 *= 10
|
||||
else:
|
||||
break
|
||||
|
||||
return str(max(k1, k2))
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
from flask_wtf import FlaskForm
|
||||
from wtforms import StringField, PasswordField, BooleanField, SubmitField
|
||||
from wtforms.validators import DataRequired
|
||||
|
||||
|
||||
class LoginForm(FlaskForm):
|
||||
id_user = StringField('Id астронавта', validators=[DataRequired()])
|
||||
pas_user = PasswordField('Пароль астронавта', validators=[DataRequired()])
|
||||
id_cap = StringField('Id капитана', validators=[DataRequired()])
|
||||
pas_cap = PasswordField('Пароль капитана', validators=[DataRequired()])
|
||||
# remember_me = BooleanField('Запомнить меня') <p>{{ form.remember_me() }} {{ form.remember_me.label }}</p>
|
||||
submit = SubmitField('Доступ')
|
||||
|
||||
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
from flask import Flask, render_template, redirect
|
||||
from loginform import LoginForm
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config['SECRET_KEY'] = 'yandexlyceum_secret_key'
|
||||
|
||||
|
||||
@app.route('/')
|
||||
@app.route('/index')
|
||||
def index(label):
|
||||
param = {'label': 'И на Марсе будут яблони цвести!', 'title': label}
|
||||
return render_template('index.html', **param)
|
||||
|
||||
|
||||
@app.route('/training/<prof>')
|
||||
def training(prof):
|
||||
param = {'title': "Тренировки в полёте", "spec": prof}
|
||||
return render_template('training.html', **param)
|
||||
|
||||
|
||||
@app.route('/list_prof/<var>')
|
||||
def list_prof(var):
|
||||
param = {'title': "Список профессий", "var": var}
|
||||
return render_template('list_prof.html', **param)
|
||||
|
||||
|
||||
@app.route('/answer')
|
||||
@app.route('/auto_answer')
|
||||
def answer():
|
||||
param = {'title': "Анкета", 'surname': "Фёдоров", 'name': "Марк", 'education': "Среднее", 'profession': " Писатель",
|
||||
'sex': "Male", 'motivation': "Распространить хип-хоп в космос!", 'ready': "True"}
|
||||
return render_template('auto_answer.html', **param)
|
||||
|
||||
|
||||
@app.route('/login', methods=['GET', 'POST'])
|
||||
def login():
|
||||
param = {'title': "Аварийный доступ"}
|
||||
form = LoginForm()
|
||||
if form.validate_on_submit():
|
||||
return redirect('/success')
|
||||
return render_template('login.html', **param, form=form)
|
||||
|
||||
|
||||
@app.route('/distribution')
|
||||
def success():
|
||||
param = {'title': "По каютам!", "users": ['Ридли Скотт', 'Энди Уир', 'Марк Уотни', "Венката Капур",
|
||||
'Тедди Сандерс', 'Шон Бин']}
|
||||
return render_template('distribution.html', **param)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(port=8080, host='127.0.0.1')
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
h4.color_edit {
|
||||
color: "black";
|
||||
}
|
||||
|
||||
p.padmarging {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
{% extends "base_two.html" %}
|
||||
|
||||
{% block content1 %}
|
||||
<div class="alert alert-light" role="alert">
|
||||
<h4><font color="#DCDCDC">И на Марсе будут яблони цвести!</font></h4>
|
||||
</div>
|
||||
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Фамилия: {{surname}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Имя: {{name}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Образование: {{education}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Профессия: {{profession}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Пол: {{sex}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Мотивация: {{motivation}}</p></h4>
|
||||
<h4 class="color_edit"><p style="padding-left: 60px">Готовы остаться на Марсе? {{ready}}</p></h4>
|
||||
{% endblock %}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!-- Required meta tags -->
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<!-- Bootstrap CSS -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
|
||||
rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"
|
||||
crossorigin="anonymous">
|
||||
|
||||
<!-- <link rel="stylesheet" type="text/css" href="static/css/style.css" /> -->
|
||||
<title>{{title}}</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar navbar-light bg-light">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand mb-0" href="#"><h1>Миссия Колонизация Марса</h1></a>
|
||||
<div class="navbar-text mb-0 h5">
|
||||
Mars One
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<!-- Begin page content -->
|
||||
<main role="main" class="container-fluid">
|
||||
{% block content1 %}{% endblock %}
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
{% extends "base_two.html" %}
|
||||
|
||||
{% block content2 %}
|
||||
<h1><img src="../static/img/mars_ico.png">Аварийный доступ</h1><br>
|
||||
<form action="" method="post" novalidate>
|
||||
{{ form.hidden_tag() }}
|
||||
<p>
|
||||
<big>{{ form.id_user.label }}</big>><br>
|
||||
{{ form.id_user(class="form-control") }}<br>
|
||||
{% for error in form.id_user.errors %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
<big>{{ form.pas_user.label }}</big><br>
|
||||
{{ form.pas_user(class="form-control", type="password") }}<br>
|
||||
{% for error in form.pas_user.errors %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
<big>{{ form.id_cap.label }}</big><br>
|
||||
{{ form.id_cap(class="form-control") }}<br>
|
||||
{% for error in form.id_cap.errors %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
<big>{{ form.pas_cap.label }}</big><br>
|
||||
{{ form.pas_cap(class="form-control", type="password") }}<br>
|
||||
{% for error in form.pas_cap.errors %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>{{ form.submit(type="submit", class="btn btn-primary") }}</p>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
{% extends "base_two.html" %}
|
||||
|
||||
{% block content2 %}
|
||||
{% set sin = ['врач', "экзобиолог", "климатолог", "астрогеолог", "гляциолог", "метеоролог"] %}
|
||||
{% set inj = ['инженер-исследователь', "пилот", "строитель", "инженер по терраформированию",
|
||||
"специалист по радиационной защите", "инженер жизнеобеспечения", "оператор марсохода",
|
||||
"киберинженер", "штурман", "пилот дронов"] %}
|
||||
{% if spec.lower() in sin %}
|
||||
<p class="text-center h2">Научные симуляторы</p>
|
||||
<p class="text-center"><img src="/static/img/kb1.jpg" class="img-fluid"></p>
|
||||
{% elif spec.lower() in inj %}
|
||||
<p class="text-center h2">Инженерные тренажеры</p>
|
||||
<p class="text-center"><img src="/static/img/kb2.jpg" class="img-fluid"></p>
|
||||
{% else %}
|
||||
<p class="text-center h1">В наших списках ваша профессия отсутствует!</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
from flask_wtf import FlaskForm
|
||||
from wtforms import StringField, PasswordField, BooleanField, SubmitField
|
||||
from wtforms.validators import DataRequired
|
||||
|
||||
|
||||
class LoginForm(FlaskForm):
|
||||
id_user = StringField('Id астронавта', validators=[DataRequired()])
|
||||
pas_user = PasswordField('Пароль астронавта', validators=[DataRequired()])
|
||||
id_cap = StringField('Id капитана', validators=[DataRequired()])
|
||||
pas_cap = PasswordField('Пароль капитана', validators=[DataRequired()])
|
||||
# remember_me = BooleanField('Запомнить меня') <p>{{ form.remember_me() }} {{ form.remember_me.label }}</p>
|
||||
submit = SubmitField('Доступ')
|
||||
|
||||
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
from flask import Flask, render_template, redirect
|
||||
from loginform import LoginForm
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config['SECRET_KEY'] = 'yandexlyceum_secret_key'
|
||||
|
||||
|
||||
@app.route('/<label>')
|
||||
@app.route('/index/<label>')
|
||||
def index(label):
|
||||
param = {'label': 'И на Марсе будут яблони цвести!', 'title': label}
|
||||
return render_template('index.html', **param)
|
||||
|
||||
|
||||
@app.route('/training/<prof>')
|
||||
def training(prof):
|
||||
param = {'title': "Тренировки в полёте", "spec": prof}
|
||||
return render_template('training.html', **param)
|
||||
|
||||
|
||||
@app.route('/list_prof/<var>')
|
||||
def list_prof(var):
|
||||
param = {'title': "Список профессий", "var": var}
|
||||
return render_template('list_prof.html', **param)
|
||||
|
||||
|
||||
@app.route('/answer')
|
||||
@app.route('/auto_answer')
|
||||
def answer():
|
||||
param = {'title': "Анкета", 'surname': "Фёдоров", 'name': "Марк", 'education': "Среднее", 'profession': " Писатель",
|
||||
'sex': "Male", 'motivation': "Распространить хип-хоп в космос!", 'ready': "True"}
|
||||
return render_template('auto_answer.html', **param)
|
||||
|
||||
|
||||
@app.route('/login', methods=['GET', 'POST'])
|
||||
def login():
|
||||
param = {'title': "Аварийный доступ"}
|
||||
form = LoginForm()
|
||||
if form.validate_on_submit():
|
||||
return redirect('/success')
|
||||
return render_template('login.html', **param, form=form)
|
||||
|
||||
|
||||
@app.route('/distribution')
|
||||
def success():
|
||||
param = {'title': "По каютам!", "users": ['Ридли Скотт', 'Энди Уир', 'Марк Уотни', "Венката Капур",
|
||||
'Тедди Сандерс', 'Шон Бин']}
|
||||
return render_template('distribution.html', **param)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(port=8080, host='127.0.0.1')
|
||||
|
Before Width: | Height: | Size: 268 KiB |
|
Before Width: | Height: | Size: 267 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
|
@ -1,10 +0,0 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content1 %}
|
||||
<div class="alert alert-light" role="alert">
|
||||
<h4><font color="#DCDCDC">И на Марсе будут яблони цвести!</font></h4>
|
||||
</div>
|
||||
<div class="container">
|
||||
{% block content2 %}{% endblock %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
{% extends "base_two.html" %}
|
||||
|
||||
{% block content2 %}
|
||||
<h1 align="center">Размещение по каютам</h1>
|
||||
{% for user in users %}
|
||||
<h3>{{ user }} - Каюта № {{ loop.index }} {% if loop.first %} - первый в очереди {% endif %}</h3>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content1 %}
|
||||
<h4>{{label}}</h4>
|
||||
{% endblock %}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
{% extends "base_two.html" %}
|
||||
|
||||
{% block content2 %}
|
||||
{% set all_prof = ['врач', "экзобиолог", "климатолог", "астрогеолог", "гляциолог", "метеоролог",
|
||||
'инженер-исследователь', "пилот", "строитель", "инженер по терраформированию",
|
||||
"специалист по радиационной защите", "инженер жизнеобеспечения", "оператор марсохода",
|
||||
"киберинженер", "штурман", "пилот дронов"] %}
|
||||
{% if var == "ol" %}
|
||||
<p class="h1">Список профессий</p>
|
||||
<div class="container">
|
||||
<ol>
|
||||
{% for p in all_prof %}
|
||||
<li class="h5">{{p}}</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
</div>
|
||||
{% elif var == "ul" %}
|
||||
<p class="h1">Список профессий</p>
|
||||
<div class="container">
|
||||
{% for p in all_prof %}
|
||||
<li class="h5">{{p}}</li>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="h1">Индекс указан неправильно!</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
from io import BytesIO
|
||||
from PIL import Image
|
||||
from delta import delta
|
||||
import requests
|
||||
|
||||
|
||||
search_api_server = "https://search-maps.yandex.ru/v1/"
|
||||
api_key = "your_yandex_api_key_here"
|
||||
|
||||
address_ll = "37.588392,55.734036"
|
||||
|
||||
search_params = {
|
||||
"apikey": api_key,
|
||||
"text": "магазин",
|
||||
"lang": "ru_RU",
|
||||
"ll": address_ll,
|
||||
"type": "biz"
|
||||
}
|
||||
|
||||
response = requests.get(search_api_server, params=search_params)
|
||||
if not response:
|
||||
pass
|
||||
|
||||
json_response = response.json()
|
||||
|
||||
organization = json_response["features"][0]
|
||||
org_name = organization["properties"]["CompanyMetaData"]["name"]
|
||||
org_address = organization["properties"]["CompanyMetaData"]["address"]
|
||||
|
||||
point = organization["geometry"]["coordinates"]
|
||||
org_point = "{0},{1}".format(point[0], point[1])
|
||||
delta = delta(point, address_ll)
|
||||
|
||||
map_params = {
|
||||
"ll": address_ll,
|
||||
"spn": ",".join([delta, delta]),
|
||||
"l": "map",
|
||||
"pt": "{0},pm2dgl".format(org_point)
|
||||
}
|
||||
|
||||
map_api_server = "http://static-maps.yandex.ru/1.x/"
|
||||
response = requests.get(map_api_server, params=map_params)
|
||||
|
||||
Image.open(BytesIO(
|
||||
response.content)).show()
|
||||