Изменена структура сайта, создана система разделов: первый раздел - дневник, второй - приложения с маршрутами.

This commit is contained in:
Andrei 2022-10-29 22:35:53 +05:00
parent c2fcc6b9d3
commit 7044e2ec8f
31 changed files with 380 additions and 230 deletions

297
main.py
View File

@ -57,7 +57,7 @@ def save_photo(photo, login, post=False, id_post=None):
elif post and id_post is not None:
with open(f'static/app_image/post_photo/{login}_post_{id_post}.png', 'wb') as f:
photo.save(f)
return f'../static/app_image/post_photo/{login}_post_{id_post}.png'
return f'static/app_image/post_photo/{login}_post_{id_post}.png'
def secret_key():
@ -69,13 +69,36 @@ def load_user(user_id):
db_sess = db_session.create_session()
return db_sess.query(User).get(user_id)
@app.route('/')
def main_page():
return render_template('main.html', title='moona')
return render_template('/main/main.html')
@app.route('/safeappschool/login')
def safe_app_school_login():
pass
@app.route('/edit_profile/<string:logins>', methods=['GET', 'POST'])
@app.route('/safeappschool/main')
def safe_app_school_main():
pass
@app.route('/safeappschool/about')
def safe_app_school_about():
pass
@app.route('/safeappschool/go')
def safe_app_school_go():
pass
@app.route('/diary/')
def main_diary_page():
return render_template('diary/main.html', title='moona')
@app.route('/diary/edit_profile/<string:logins>', methods=['GET', 'POST'])
def edit_profile(logins):
if current_user.is_authenticated:
global photo
@ -84,7 +107,7 @@ def edit_profile(logins):
form = RegisterForm()
session = db_session.create_session()
ph_f = False
if current_user.photo != '../static/img/None_logo.png':
if current_user.photo != '../../static/img/None_logo.png':
photo = current_user.photo
ph_f = True
else:
@ -92,20 +115,20 @@ def edit_profile(logins):
if form.del_photo.data:
help_arg = photo
ph_f = False
photo = '../static/img/None_logo.png'
photo = '../../static/img/None_logo.png'
if form.submit2.data:
user = session.query(User).filter(User.login == logins).first()
if user.email != form.email.data:
if session.query(User).filter(User.email == form.email.data).first():
if not form.photo.data and help_arg:
help_arg = False
return render_template('edit_profile.html', title='Редактирование профиля', form=form,
return render_template('diary/edit_profile.html', title='Редактирование профиля', form=form,
ph_f=ph_f,
message="Такая почта уже есть")
else:
help_arg = True
help_arg_2 = form.email.data
return redirect('/confirmation')
return redirect('/diary/confirmation')
user.name = form.name.data
user.surname = form.surname.data
user.age = form.age.data
@ -115,15 +138,15 @@ def edit_profile(logins):
if help_arg:
os.remove(help_arg)
help_arg = False
photo = '../static/img/None_logo.png'
photo = '../../static/img/None_logo.png'
user.photo = photo
session.commit()
if user.email == form.email.data:
return redirect('/profile')
return redirect('/diary/profile')
else:
help_arg_2 = form.email.data
help_arg = False
return redirect('/confirmation')
return redirect('/diary/confirmation')
if request.method == "GET":
if current_user.login == logins:
form.email.data = current_user.email
@ -136,12 +159,13 @@ def edit_profile(logins):
form.password2.data = None
if not form.photo.data and help_arg:
help_arg = False
return render_template('edit_profile.html', title='Редактирование профиля', form=form, message='', ph_f=ph_f)
return render_template('diary/edit_profile.html', title='Редактирование профиля', form=form, message='',
ph_f=ph_f)
else:
return redirect('/login')
return redirect('/diary/login')
@app.route('/profile')
@app.route('/diary/profile')
def profile():
if current_user.is_authenticated:
global help_arg_2
@ -173,13 +197,13 @@ def profile():
message = 'Ваша почта успешно изменена!' if help_arg_2 == 'EditEmail' else ''
if help_arg_2:
help_arg_2 = False
return render_template('profile.html', title='Профиль', pub_post=pub_post, emotion_pub=emotion_pub,
return render_template('diary/profile.html', title='Профиль', pub_post=pub_post, emotion_pub=emotion_pub,
message=message)
else:
return redirect('/login')
return redirect('/diary/login')
@app.route('/new_like/<int:user_id>/<int:post_id>/<string:ret_href>')
@app.route('/diary/new_like/<int:user_id>/<int:post_id>/<string:ret_href>')
def new_like(user_id, post_id, ret_href):
if current_user.is_authenticated:
session = db_session.create_session()
@ -194,9 +218,9 @@ def new_like(user_id, post_id, ret_href):
session.delete(find)
session.commit()
if ret_href != 'main':
return redirect(f"/{ret_href}")
return redirect(f"/diary/{ret_href}")
else:
return redirect('/')
return redirect('/diary/')
else:
popular = session.query(Popularity).filter(Popularity.post == post_id).first()
if not popular:
@ -214,14 +238,14 @@ def new_like(user_id, post_id, ret_href):
session.add(like)
session.commit()
if ret_href != 'main':
return redirect(f"/{ret_href}")
return redirect(f"/diary/{ret_href}")
else:
return redirect('/')
return redirect('/diary/')
else:
return redirect('/')
return redirect('/diary/')
@app.route('/publications', methods=['GET', 'POST'])
@app.route('/diary/publications', methods=['GET', 'POST'])
def publications():
session = db_session.create_session()
fresh_posts_betta = session.query(DiaryPost).filter(DiaryPost.public == 1).all()[::-1]
@ -325,12 +349,13 @@ def publications():
if session.query(Like).filter(Like.post == i.id, Like.user == current_user.id).first():
emotion['is_like'] = 1
emotion_for_you.append(emotion)
return render_template('publications.html', fresh_post=fresh_posts, emotion_fresh=emotion_fresh, title='Публикации',
return render_template('diary/publications.html', fresh_post=fresh_posts, emotion_fresh=emotion_fresh,
title='Публикации',
pop_post=pop_post, emotion_pop=emotion_pop, for_you_post=for_you_post,
emotion_for_you=emotion_for_you)
@app.route('/answer_quest/<int:id>', methods=['GET', 'POST'])
@app.route('/diary/answer_quest/<int:id>', methods=['GET', 'POST'])
def answer_quest(id):
if current_user.is_authenticated:
session = db_session.create_session()
@ -352,18 +377,18 @@ def answer_quest(id):
quest.all_used = True
session.add(answer_user)
session.commit()
return redirect('/diary')
return redirect('/diary/diary')
else:
ans_quest = session.query(Answer).filter(Answer.id_question == id).first()
ans_quest.answer = answer.answer.data
session.commit()
return redirect('/diary')
return render_template('answer_quest.html', tetle='Ответ на вопрос', form=answer, message='', quest=quest)
return redirect('/diary/diary')
return render_template('diary/answer_quest.html', tetle='Ответ на вопрос', form=answer, message='', quest=quest)
else:
return redirect('/')
return redirect('/diary/')
@app.route('/delete_quest/<int:id>', methods=['GET', 'POST'])
@app.route('/diary/delete_quest/<int:id>', methods=['GET', 'POST'])
def delete_quest(id):
if current_user.is_authenticated:
session = db_session.create_session()
@ -373,12 +398,12 @@ def delete_quest(id):
session.commit()
else:
abort(404)
return redirect('/add_question')
return redirect('/diary/add_question')
else:
return redirect('/')
return redirect('/diary/')
@app.route('/add_question', methods=['GET', 'POST'])
@app.route('/diary/add_question', methods=['GET', 'POST'])
def add_question():
if current_user.is_authenticated:
if current_user.role == 'admin':
@ -386,7 +411,7 @@ def add_question():
session = db_session.create_session()
if que.validate_on_submit():
if que.quest.data in list(map(lambda x: x.quest, session.query(Quest).all())):
return render_template('add_question.html', message='Такой вопрос уже есть!',
return render_template('diary/add_question.html', message='Такой вопрос уже есть!',
title='Добавить вопрос',
form=que)
new_que = Quest()
@ -394,15 +419,15 @@ def add_question():
session.add(new_que)
session.commit()
que.quest.data = ''
return render_template('add_question.html', message='', title='Добавить вопрос', form=que,
return render_template('diary/add_question.html', message='', title='Добавить вопрос', form=que,
question=session.query(Quest).all())
else:
return redirect('/')
return redirect('/diary/')
else:
return redirect('/')
return redirect('/diary/')
@app.route('/post/<int:id>', methods=['GET', 'POST'])
@app.route('/diary/post/<int:id>', methods=['GET', 'POST'])
def post_edit(id):
if current_user.is_authenticated:
session = db_session.create_session()
@ -457,19 +482,19 @@ def post_edit(id):
if not post_ed.public.data and check_pop:
session.delete(check_pop)
session.commit()
return redirect('/diary')
return redirect('/diary/diary')
else:
abort(404)
return render_template('post.html', form=post_ed, message='', title='Изменить запись', pht=ph_f)
return render_template('diary/post.html', form=post_ed, message='', title='Изменить запись', pht=ph_f)
else:
return redirect('/diary')
return redirect('/diary/diary')
else:
return redirect('/diary')
return redirect('/diary/diary')
else:
return redirect('/login')
return redirect('/diary/login')
@app.route('/post_deleted/<int:id>', methods=['GET', 'POST'])
@app.route('/diary/post_deleted/<int:id>', methods=['GET', 'POST'])
def post_deleted(id):
if current_user.is_authenticated:
session = db_session.create_session()
@ -491,16 +516,16 @@ def post_deleted(id):
session.commit()
else:
abort(404)
return redirect('/diary')
return redirect('/diary/diary')
else:
return redirect('/diary')
return redirect('/diary/diary')
else:
return redirect('/diary')
return redirect('/diary/diary')
else:
return redirect('/login')
return redirect('/diary/login')
@app.route('/add_post', methods=['GET', 'POST'])
@app.route('/diary/add_post', methods=['GET', 'POST'])
def add_post():
if current_user.is_authenticated:
pos = AddPost()
@ -526,7 +551,7 @@ def add_post():
link=pos.link.data)
session.add(diart_pos)
session.commit()
return redirect("/diary")
return redirect("/diary/diary")
else:
diart_pos = DiaryPost(name=pos.name.data,
text=pos.text.data,
@ -538,13 +563,13 @@ def add_post():
link=pos.link.data)
session.add(diart_pos)
session.commit()
return redirect("/diary")
return render_template('post.html', form=pos, title='Новый пост', message='')
return redirect("/diary/diary")
return render_template('diary/post.html', form=pos, title='Новый пост', message='')
else:
return redirect('/login')
return redirect('/diary/login')
@app.route('/diary', methods=['GET', 'POST'])
@app.route('/diary/diary', methods=['GET', 'POST'])
def diary():
db_sess = db_session.create_session()
if current_user.is_authenticated:
@ -622,18 +647,18 @@ def diary():
lis_emotion = None
emotion_pub = None
pub_post = None
return render_template('diary.html', title='Дневник', my_post=posts, message='', question=post_quest,
return render_template('diary/diary.html', title='Дневник', my_post=posts, message='', question=post_quest,
ans=ans2, emotion=lis_emotion, emotion_pub=emotion_pub, pub_post=pub_post)
@app.route('/logout')
@app.route('/diary/logout')
@login_required
def logout():
logout_user()
return redirect("/")
return redirect("/diary/")
@app.route('/login', methods=['GET', 'POST'])
@app.route('/diary/login', methods=['GET', 'POST'])
def login():
form = LoginForm()
if form.validate_on_submit():
@ -641,14 +666,14 @@ def login():
user = db_sess.query(User).filter(User.email == form.email.data).first()
if user and user.check_password(form.password.data):
login_user(user, remember=form.remember_me.data)
return redirect("/")
return render_template('login.html',
return redirect("/diary/")
return render_template('diary/login.html',
message="Неправильный логин или пароль",
form=form)
return render_template('login.html', title='Авторизация', form=form, message='')
return render_template('diary/login.html', title='Авторизация', form=form, message='')
@app.route('/confirmation', methods=['GET', 'POST'])
@app.route('/diary/confirmation', methods=['GET', 'POST'])
def confirmation():
global help_arg
if help_arg:
@ -686,7 +711,7 @@ def confirmation():
about=form.about.data,
email=form.email.data,
role='user',
photo='../static/img/None_logo.png'
photo='../../static/img/None_logo.png'
)
user.set_password(form.password.data)
session.add(user)
@ -694,21 +719,21 @@ def confirmation():
send_msg = False
help_arg = False
if form.simple:
return redirect('/simple/can_close')
return redirect('/diary/simple/can_close')
else:
return redirect('/login')
return redirect('/diary/login')
else:
if form.simple:
return render_template('simple_confimication.html', title='Подтверждение', form=conf,
message='Коды не совпадают')
else:
return render_template('confirmation_reg.html', title='Подтверждение', form=conf,
return render_template('diary/confirmation_reg.html', title='Подтверждение', form=conf,
message='Коды не совпадают')
if form.simple:
return render_template('simple_confimication.html', title='Подтверждение', form=conf,
message='Коды не совпадают')
else:
return render_template('confirmation_reg.html', title='Подтверждение', form=conf, message='')
return render_template('diary/confirmation_reg.html', title='Подтверждение', form=conf, message='')
else:
conf = Confirmation()
if not send_msg:
@ -723,98 +748,49 @@ def confirmation():
session.commit()
send_msg = False
help_arg = False
return redirect('/profile')
return redirect('/diary/profile')
if form.simple:
return render_template('simple_confimication.html', title='Подтверждение', form=conf,
message='Коды не совпадают')
else:
return render_template('confirmation_reg.html', title='Подтверждение', form=conf, message='')
return render_template('diary/confirmation_reg.html', title='Подтверждение', form=conf, message='')
else:
return redirect('/')
return redirect('/diary/')
@app.route('/school_app_check_auth', methods=['POST'])
def check_auth():
req = request.json
email = req['login']
password = req['password']
session = db_session.create_session()
user = session.query(User).filter(User.email == email).first()
if user:
if user.check_password(password) or user.check_hash_password(password):
return make_response(jsonify({
'key': open('key.txt', 'r', encoding='utf-8').read(),
'name': user.name,
'surname': user.surname,
'login': user.login,
'hash': user.password
}), 200)
else:
return abort(403)
else:
return abort(404)
@app.route('/simple/can_close')
def can_close():
return render_template('simple_can_close.html', title='Можете закрыть страницу')
@app.route('/register', methods=['GET', 'POST'])
@app.route('/diary/register', methods=['GET', 'POST'])
def register():
global help_arg
global photo
form = RegisterForm()
if form.validate_on_submit():
if form.password.data != form.password2.data:
return render_template('register.html', title='Регистрация',
return render_template('diary/register.html', title='Регистрация',
form=form,
message="Пароли не совпадают")
session = db_session.create_session()
if session.query(User).filter(User.login == form.login.data).first():
return render_template('register.html', title='Регистрация',
return render_template('diary/register.html', title='Регистрация',
form=form,
message="Такой пользователь уже есть")
if session.query(User).filter(User.email == form.email.data).first():
return render_template('register.html', title='Регистрация',
return render_template('diary/register.html', title='Регистрация',
form=form,
message="Такая почта уже есть")
help_arg = form
if form.photo.data:
photo = save_photo(form.photo.data, form.login.data)
return redirect('/confirmation')
return render_template('register.html', title='Регистрация', form=form, message='')
return redirect('/diary/confirmation')
return render_template('diary/register.html', title='Регистрация', form=form, message='')
@app.route('/simple/register', methods=['GET', 'POST'])
def school_reg():
global help_arg
global photo
form = RegisterForm()
form.simple = True
if form.validate_on_submit():
if form.password.data != form.password2.data:
return render_template('simple_register.html', title='Регистрация',
form=form,
message="Пароли не совпадают")
session = db_session.create_session()
if session.query(User).filter(User.login == form.login.data).first():
return render_template('simple_register.html', title='Регистрация',
form=form,
message="Такой пользователь уже есть")
if session.query(User).filter(User.email == form.email.data).first():
return render_template('simple_register.html', title='Регистрация',
form=form,
message="Такая почта уже есть")
help_arg = form
if form.photo.data:
photo = save_photo(form.photo.data, form.login.data)
return redirect('/confirmation')
return render_template('simple_register.html', title='Регистрация', form=form, message='')
@app.route('/diary/about_us')
def about():
return render_template('diary/about.html', title='О нас')
@app.route('/recovery', methods=['GET', 'POST'])
@app.route('/diary/recovery', methods=['GET', 'POST'])
def recovery():
global send_msg
global secret_code
@ -830,11 +806,11 @@ def recovery():
secret_code = secret_key()
mail(f'Ваш секретный код: {secret_code}', form.email.data, 'Восстановление пароля')
send_msg = True
return render_template('recovery.html', title='Восстановление пароля', form=conf, message='', s='2')
return render_template('diary/recovery.html', title='Восстановление пароля', form=conf, message='', s='2')
if conf.validate_on_submit():
if str(conf.code_key.data).strip() == str(secret_code).strip():
help_arg = True
return render_template('recovery.html', title='Восстановление пароля', form=finish, message='', s='3')
return render_template('diary/recovery.html', title='Восстановление пароля', form=finish, message='', s='3')
if help_arg:
if finish.validate_on_submit():
db_sess = db_session.create_session()
@ -844,13 +820,62 @@ def recovery():
session.add(user2)
session.commit()
send_msg = False
return redirect('/login')
return render_template('recovery.html', title='Восстановление пароля', form=form, message='', s='1')
return redirect('/diary/login')
return render_template('diary/recovery.html', title='Восстановление пароля', form=form, message='', s='1')
@app.route('/about_us')
def about():
return render_template('about.html', title='О нас')
@app.route('/school_app_check_auth', methods=['POST'])
def check_auth():
req = request.json
email = req['login']
password = req['password']
session = db_session.create_session()
user = session.query(User).filter(User.email == email).first()
if user:
if user.check_password(password) or user.check_hash_password(password):
return make_response(jsonify({
'key': open('key.txt', 'r', encoding='utf-8').read(),
'name': user.name,
'surname': user.surname,
'login': user.login,
'hash': user.password
}), 200)
else:
return abort(403)
else:
return abort(404)
@app.route('/simple/can_close')
def can_close():
return render_template('simple/simple_can_close.html', title='Можете закрыть страницу')
@app.route('/simple/register', methods=['GET', 'POST'])
def school_reg():
global help_arg
global photo
form = RegisterForm()
form.simple = True
if form.validate_on_submit():
if form.password.data != form.password2.data:
return render_template('simple/simple_register.html', title='Регистрация',
form=form,
message="Пароли не совпадают")
session = db_session.create_session()
if session.query(User).filter(User.login == form.login.data).first():
return render_template('simple/simple_register.html', title='Регистрация',
form=form,
message="Такой пользователь уже есть")
if session.query(User).filter(User.email == form.email.data).first():
return render_template('simple/simple_register.html', title='Регистрация',
form=form,
message="Такая почта уже есть")
help_arg = form
if form.photo.data:
photo = save_photo(form.photo.data, form.login.data)
return redirect('/diary/confirmation')
return render_template('simple/simple_register.html', title='Регистрация', form=form, message='')
def main():

View File

@ -1,5 +1,5 @@
body {
background-image: url('../img/big_back_moona.png');
background-image: url('../../img/big_back_moona.png');
}
.header, .body {
width: 80%;

75
static/css/main/main.css Normal file
View File

@ -0,0 +1,75 @@
body {
background-image: url('../../img/big_back_moona.png');
font-family: 'Comfortaa', sans-serif;
background-color: #f0ffff;
}
.header, .body {
width: 70%;
margin-left: auto;
margin-right: auto;
}
.body {
margin-top: 5%;
}
.header_logo {
width: 60%;
margin-left: 20%;
margin-right: 20%;
}
.header_title {
text-align: center;
color: white;
margin-left: 27%;
margin-right: 27%;
width: 46%;
height: auto;
margin-top: 15px;
transition: font-size 0.5s ease-in, text-shadow 1s ease-in;
}
.header_title:hover {
font-size: 33;
text-shadow: 0px 0px 20px #ffffff;
}
.article_one, .article_two {
margin-top: 5%;
width: 90%;
margin-left: 5%;
margin-right: 5%;
max-height: 60%;
display: flex;
justify-content: space-around;
}
.article_one_text_back, .article_two_text_back {
width: 50%;
background: linear-gradient(45deg, #d1c3fc, #9bc4fc);
border-radius: 20px;
height: 94%;
align-self: center;
transition: border-radius 0.5s ease-in, box-shadow 1s ease-in;
}
.article_one_text_back:hover, .article_two_text_back:hover {
border-radius: 30px;
box-shadow: 0px 0px 50px #fff;
}
.article_one_text, .article_two_text {
width: 94%;
height: 94%;
margin-top: 3%;
margin-left: 3%;
overflow: auto;
color: white;
text-align: justify;
font-size: 20px;
}
.article_one_image, .article_two_image {
width: 250px;
height: 250px;
background: linear-gradient(45deg, #fffeff, #d7fffe);
border-radius: 16px;
transition: border-radius 0.5s ease-in, box-shadow 1s ease-in;
align-self: center;
}
.article_one_image:hover, .article_two_image:hover {
border-radius: 22px;
box-shadow: 0px 0px 30px #ffffff;
}

BIN
static/img/maps.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

@ -1,5 +1,5 @@
<link rel="stylesheet" href="../static/css/about.css">
{% extends "base.html" %}
<link rel="stylesheet" href="../../static/css/diary/about.css">
{% extends "diary/base.html" %}
{% block content %}
<div>

View File

@ -1,6 +1,6 @@
<link rel="stylesheet" href="../static/css/diary.css">
<link rel="stylesheet" href="../static/css/question.css">
{% extends "base.html" %}
<link rel="stylesheet" href="../../static/css/diary/diary.css">
<link rel="stylesheet" href="../../static/css/diary/question.css">
{% extends "diary/base.html" %}
{% block content %}
{% if current_user.is_authenticated and (current_user.role == 'admin' or current_user.role == 'moder') %}

View File

@ -1,6 +1,6 @@
<link rel="stylesheet" href="../static/css/diary.css">
<link rel="stylesheet" href="../static/css/question.css">
{% extends "base.html" %}
<link rel="stylesheet" href="../../static/css/diary/diary.css">
<link rel="stylesheet" href="../../static/css/diary/question.css">
{% extends "diary/base.html" %}
{% block content %}
{% if current_user.is_authenticated %}

View File

@ -9,7 +9,7 @@
<link rel="icon" href="../static/img/MoonCcircl.ico" type="image/x-icon">
<link href="https://fonts.googleapis.com/css2?family=Comfortaa:wght@700&family=Montserrat+Alternates:wght@600&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="../static/css/base.css">
<link rel="stylesheet" href="../../static/css/diary/base.css">
<title>{{title}}</title>
</head>
<body>
@ -47,15 +47,15 @@
</symbol>
</svg>
<div class="d-flex flex-column flex-shrink-0 bg-light" style="width: 5rem; height: 0px;">
<a href="/" class="d-block p-3 link-dark text-decoration-none" title="Icon-only" data-bs-toggle="tooltip"
<a href="/diary/" class="d-block p-3 link-dark text-decoration-none" title="Icon-only" data-bs-toggle="tooltip"
data-bs-placement="right">
<object type="image/svg+xml" data="../static/img/Логотим Moona.svg" width="54" height="54">
<object type="image/svg+xml" data="../../static/img/Логотим Moona.svg" width="54" height="54">
Your browser does not support SVG
</object>
</a>
<ul class="nav nav-pills nav-flush flex-column mb-auto text-center">
<li class="nav-item">
<a href="/" class="nav-link py-3 border-bottom" title="Главная"
<a href="/diary/" class="nav-link py-3 border-bottom" title="Главная"
data-bs-toggle="tooltip" data-bs-placement="right">
<svg class="bi" width="24" height="24" role="img" aria-label="Главная">
<use xlink:href="#home"/>
@ -63,7 +63,7 @@
</a>
</li>
<li>
<a href="/diary" class="nav-link py-3 border-bottom" title="Дневник" data-bs-toggle="tooltip"
<a href="/diary/diary" class="nav-link py-3 border-bottom" title="Дневник" data-bs-toggle="tooltip"
data-bs-placement="right">
<svg class="bi" width="24" height="24" role="img" aria-label="Дневник">
<use xlink:href="#diary"/>
@ -71,7 +71,7 @@
</a>
</li>
<li>
<a href="/publications" class="nav-link py-3 border-bottom" title="Публикации" data-bs-toggle="tooltip"
<a href="/diary/publications" class="nav-link py-3 border-bottom" title="Публикации" data-bs-toggle="tooltip"
data-bs-placement="right">
<svg class="bi" width="24" height="24" role="img" aria-label="Публикации">
<use xlink:href="#posts"/>
@ -79,7 +79,7 @@
</a>
</li>
<li>
<a href="/about_us" class="nav-link py-3 border-bottom" title="О нас" data-bs-toggle="tooltip"
<a href="/diary/about_us" class="nav-link py-3 border-bottom" title="О нас" data-bs-toggle="tooltip"
data-bs-placement="right">
<svg class="bi" width="24" height="24" role="img" aria-label="О нас">
<use xlink:href="#about"/>
@ -88,12 +88,12 @@
</li>
<li>
{% if current_user.is_authenticated %}
<a href="/profile" class="nav-link py-3 border-bottom" title="Профиль" data-bs-toggle="tooltip"
<a href="/diary/profile" class="nav-link py-3 border-bottom" title="Профиль" data-bs-toggle="tooltip"
data-bs-placement="right">
<img class="user_img" src="../{{ current_user.photo }}" width="40" height="40">
<img class="user_img" src="../../{{ current_user.photo }}" width="40" height="40">
</a>
{% else %}
<a href="/login" class="nav-link py-3 border-bottom" title="Профиль" data-bs-toggle="tooltip"
<a href="/diary/login" class="nav-link py-3 border-bottom" title="Профиль" data-bs-toggle="tooltip"
data-bs-placement="right">
<svg class="bi" width="24" height="24" role="img" aria-label="Профиль">
<use xlink:href="#profil"/>

View File

@ -1,6 +1,6 @@
<meta charset="UTF-8">
<link rel="stylesheet" href="../static/css/register.css">
{% extends "base.html" %}
<link rel="stylesheet" href="../static/css/diary/register.css">
{% extends "diary/base.html" %}
{% block content %}
<div class="divlog">
<h1 class="title">Подтверждение почты</h1>

View File

@ -1,11 +1,11 @@
<link rel="stylesheet" href="../static/css/diary.css">
{% extends "base.html" %}
<link rel="stylesheet" href="../static/css/diary/diary.css">
{% extends "diary/base.html" %}
{% block content %}
{% if current_user.is_authenticated %}
<h1 class="upp_zag">Дневник</h1>
<div>
<a href="/add_post" id="add_post" class="btn btn-primary"
<a href="/diary/add_post" id="add_post" class="btn btn-primary"
style="background-color:#1daff0;border-radius: 15px;"><strong>Добавить
запись</strong></a>
</div>
@ -55,7 +55,7 @@
{% endif %}
{% if item.photo != None %}
<div class="photo">
<img width="90%" src="{{ item.photo }}"
<img width="90%" src="../../{{ item.photo }}"
style="border-radius: 22px;">
</div>
{% endif %}
@ -83,27 +83,27 @@
{% endif %}
<div class="like">
<a type="button"
href="/new_like/{{current_user.id}}/{{item.id}}/diary">
href="/diary/new_like/{{current_user.id}}/{{item.id}}/diary">
{% if emotion_pub[loop.index0]['is_like'] %}
<img src="../static/img/like_add.png" width="117" height="100">
<img src="../../static/img/like_add.png" width="117" height="100">
{% else %}
<img src="../static/img/like.png" width="94" height="80">
<img src="../../static/img/like.png" width="94" height="80">
{% endif %}
</a>
{% if emotion_pub[loop.index0]['like'] != None %}
<p style="color:#ffffff">{{emotion_pub[loop.index0]['like']}}</p>
{% endif %}
</div>
<div class="my_author"><img src="../{{ current_user.photo }}" width="40" height="40"
<div class="my_author"><img src="../../{{ current_user.photo }}" width="40" height="40"
style="border-radius: 22px">
<strong style="color: #ffffff">{{ current_user.name }}</strong>
</div>
<strong style="color:#ffffff">{{item.date}}</strong>
<div>
<a style="border-radius: 15px;" href="/post/{{ item.id }}" class="btn" id="edit_btn">
<a style="border-radius: 15px;" href="/diary/post/{{ item.id }}" class="btn" id="edit_btn">
Изменить
</a>
<a style="border-radius: 15px;" href="/post_deleted/{{ item.id }}" class="btn btn-danger">
<a style="border-radius: 15px;" href="/diary/post_deleted/{{ item.id }}" class="btn btn-danger">
Удалить
</a>
</div>
@ -161,7 +161,7 @@
{% endif %}
{% if item.photo != None %}
<div class="photo">
<img width="90%" src="{{ item.photo }}"
<img width="90%" src="../../{{ item.photo }}"
style="border-radius: 22px;">
</div>
{% endif %}
@ -187,16 +187,16 @@
приватная
</div>
{% endif %}
<div class="my_author"><img src="../{{ current_user.photo }}" width="40" height="40"
<div class="my_author"><img src="../../{{ current_user.photo }}" width="40" height="40"
style="border-radius: 22px">
<strong style="color: #ffffff">{{ current_user.name }}</strong>
</div>
<strong style="color:#ffffff">{{item.date}}</strong>
<div>
<a style="border-radius: 15px;" href="/post/{{ item.id }}" class="btn" id="edit_btn1">
<a style="border-radius: 15px;" href="/diary/post/{{ item.id }}" class="btn" id="edit_btn1">
Изменить
</a>
<a style="border-radius: 15px;" href="/post_deleted/{{ item.id }}" class="btn btn-danger">
<a style="border-radius: 15px;" href="/diary/post_deleted/{{ item.id }}" class="btn btn-danger">
Удалить
</a>
</div>
@ -216,7 +216,7 @@
<div class="my_post">
<div class="question">
{% for item in question %}
<a href="/answer_quest/{{item.id}}" class="btn quest_block">
<a href="/diary/answer_quest/{{item.id}}" class="btn quest_block">
{% if item.id in ans %}
<div class="is_ans">
<strong>{{item.quest}}</strong>
@ -241,10 +241,10 @@
<div class="bad_centre">
<h1 id="hz1">Вы не авторизованы в системе</h1>
<h2 id="hz2">Поэтому вам не доступна страница личного дневника</h2><strong id="sz1">Но вы можете посмотреть
публикации других пользователей в разделе <a href="/" style="color:#a9e4ff">Главная</a> или <a
href="/publications" style="color:#a9e4ff">Публикации</a></strong>
публикации других пользователей в разделе <a href="/diary/" style="color:#a9e4ff">Главная</a> или <a
href="/diary/publications" style="color:#a9e4ff">Публикации</a></strong>
<p></p>
<img id="image" src="../static/img/Надпись Moona без фона.png"></div>
<img id="image" src="../../static/img/string_moona_no_back.png"></div>
</div>
{% endif %}
{% endblock %}

View File

@ -1,6 +1,6 @@
<meta charset="UTF-8">
<link rel="stylesheet" href="../static/css/register.css">
{% extends "base.html" %}
<link rel="stylesheet" href="../../static/css/diary/register.css">
{% extends "diary/base.html" %}
{% block content %}
<div class="divlog">
<h1 class="title">Изменение профиля</h1>

View File

@ -1,5 +1,5 @@
<link rel="stylesheet" href="../static/css/register.css">
{% extends "base.html" %}
<link rel="stylesheet" href="../../static/css/diary/register.css">
{% extends "diary/base.html" %}
{% block content %}
<div class="divlog" id="divlog">
@ -34,8 +34,8 @@
</div>
<div class="col-sm-10" id="buttons">{{ form.submit(type="submit", class="btn btn-primary", id="but_log1") }}
<a class="btn btn-primary" id="but_log3" type="submit"
href="/register"><strong>Регистрация</strong></a>
<a class="btn btn-primary" type="submit" id="but_log2" href="/recovery"><strong>Забыли
href="/diary/register"><strong>Регистрация</strong></a>
<a class="btn btn-primary" type="submit" id="but_log2" href="/diary/recovery"><strong>Забыли
пароль</strong></a>
</div>
{% if message != '' %}

View File

@ -1,10 +1,11 @@
<link rel="stylesheet" href="../static/css/main.css">
{% extends "base.html" %}
<link rel="stylesheet" href="../../static/css/diary/main.css">
{% extends "diary/base.html" %}
{% block content %}
<div class="header">
<img class="header_logo" src="../static/img/string_moona_no_back.png" width="50%">
<h2 class="header_title">Добро пожаловать в moona - ваш проводник в мир оптимизма, дружелюбия и единения!</h2>
<img class="header_logo" src="../../static/img/string_moona_no_back.png" width="50%">
<h2 class="header_title">Добро пожаловать в дневник от moona - ваш проводник в мир оптимизма, дружелюбия и
единения!</h2>
</div>
<div class="body">
<div class="article_one">
@ -13,10 +14,10 @@
настроение. Ведь moona - непросто дневник, а настоящая соцсеть, где вы можете поделиться своими
историями, или оставить их при себе</p>
</div>
<img class="article_one_image img-thumbnail" src="../static/img/neon_novel.png">
<img class="article_one_image img-thumbnail" src="../../static/img/neon_novel.png">
</div>
<div class="article_two">
<img class="article_two_image img-thumbnail" src="../static/img/neon_man.png">
<img class="article_two_image img-thumbnail" src="../../static/img/neon_man.png">
<div class="article_two_text_back">
<p class="article_two_text">
Ведение личного дневника:
@ -40,7 +41,7 @@
статистика помогут вам проанализировать себя :з
</p>
</div>
<img class="article_three_image img-thumbnail" src="../static/img/neon_people.png">
<img class="article_three_image img-thumbnail" src="../../static/img/neon_people.png">
</div>
<div class="join_us">
<h2 class="join_us_header">Присоединяйся к нам! Регистрируйся или авторизуйся :з</h2>

View File

@ -1,5 +1,5 @@
<link rel="stylesheet" href="../static/css/diary.css">
{% extends "base.html" %}
<link rel="stylesheet" href="../../static/css/diary/diary.css">
{% extends "diary/base.html" %}
{% block content %}
{% if current_user.is_authenticated %}
@ -88,10 +88,10 @@
<div class="bad_centre">
<h1 id="hz1">Вы не авторизованы в системе</h1>
<h2 id="hz2">Поэтому вам не доступна эта страница</h2><strong id="sz1">Но вы можете посмотреть
публикации других пользователей в разделе <a href="/" style="color:#a9e4ff">Главная</a> или <a
href="/publications" style="color:#a9e4ff">Публикации</a></strong>
публикации других пользователей в разделе <a href="/diary/" style="color:#a9e4ff">Главная</a> или <a
href="/diary/publications" style="color:#a9e4ff">Публикации</a></strong>
<p></p>
<img id="image" src="../static/img/Надпись Moona без фона.png"></div>
<img id="image" src="../../static/img/Надпись Moona без фона.png"></div>
</div>
{% endif %}
{% endblock %}

View File

@ -1,6 +1,6 @@
<link rel="stylesheet" href="../static/css/profile.css">
<link rel="stylesheet" href="../static/css/publications.css">
{% extends "base.html" %}
<link rel="stylesheet" href="../../static/css/diary/profile.css">
<link rel="stylesheet" href="../../static/css/diary/publications.css">
{% extends "diary/base.html" %}
{% block content %}
<h1 align="center">Профиль</h1>
@ -16,9 +16,9 @@
</h5>
{% endif %}
<div>
<a href="/edit_profile/{{current_user.login}}" type="submit" class="btn btn-primary"
<a href="/diary/edit_profile/{{current_user.login}}" type="submit" class="btn btn-primary"
style="background-color:#38aaff; border-radius: 15px; margin:5%; width:90%">Редактировать профиль</a>
<a style="border-radius: 15px; margin:5%; width:90%" href="/logout" class="btn btn-danger logout_btn">
<a style="border-radius: 15px; margin:5%; width:90%" href="/diary/logout" class="btn btn-danger logout_btn">
Выйти
</a>
</div>
@ -97,7 +97,7 @@
{% endif %}
<div class="like">
<a type="button"
href="/new_like/{{current_user.id}}/{{item.id}}/diary">
href="/diary/new_like/{{current_user.id}}/{{item.id}}/diary">
{% if emotion_pub[loop.index0]['is_like'] %}
<img src="../static/img/like_add.png" width="117" height="100">
{% else %}

View File

@ -1,5 +1,5 @@
<link rel="stylesheet" href="../static/css/publications.css">
{% extends "base.html" %}
<link rel="stylesheet" href="../../static/css/diary/publications.css">
{% extends "diary/base.html" %}
{% block content %}
<table class="but">
@ -9,7 +9,7 @@
</td>
{% if current_user.is_authenticated %}
<td>
<a href="/add_post" id="add_post" class="btn btn-primary"
<a href="/diary/add_post" id="add_post" class="btn btn-primary"
style="background-color:#1daff0;border-radius: 15px;"><strong>Добавить
запись</strong></a>
</td>
@ -67,7 +67,7 @@
{% if item.photo != None %}
<p></p>
<div class="photo">
<img width="90%" src="{{ item.photo }}"
<img width="90%" src="../../{{ item.photo }}"
style="border-radius: 22px;">
</div>
<p></p>
@ -75,11 +75,11 @@
{% if current_user.is_authenticated %}
<div class="like">
<a type="button"
href="/new_like/{{current_user.id}}/{{item.id}}/publications">
href="/diary/new_like/{{current_user.id}}/{{item.id}}/publications">
{% if emotion_pop[loop.index0]['is_like'] %}
<img src="../static/img/like_add.png" width="117" height="100">
<img src="../../static/img/like_add.png" width="117" height="100">
{% else %}
<img src="../static/img/like.png" width="94" height="80">
<img src="../../static/img/like.png" width="94" height="80">
{% endif %}
</a>
{% if emotion_pop[loop.index0]['like'] != None %}
@ -104,14 +104,14 @@
{% endif %}
<div class="author" style="style=position:absolute; width:148px; height:44px; left:255px; -webkit-border-radius:
22px;-moz-border-radius: 22px;border-radius: 22px; border:2px solid #FFFFFF; background-color:#1daff0; top:
98px;"><img src="../{{ emotion_pop[loop.index0]['author'].photo }}" width="40" height="40"
98px;"><img src="../../{{ emotion_pop[loop.index0]['author'].photo }}" width="40" height="40"
style="border-radius: 22px">
<strong style="color: #ffffff">{{ emotion_pop[loop.index0]['author'].name }}</strong>
</div>
<strong style="color:#ffffff">{{item.date}}</strong>
{% if current_user.is_authenticated %}
{% if current_user.role == 'admin' %}
<a style="border-radius: 15px;" href="/post_deleted/{{ item.id }}" class="btn btn-danger">
<a style="border-radius: 15px;" href="/diary/post_deleted/{{ item.id }}" class="btn btn-danger">
Удалить
</a>
{% endif %}
@ -176,7 +176,7 @@
{% if item.photo != None %}
<p></p>
<div class="photo">
<img width="90%" src="{{ item.photo }}"
<img width="90%" src="../../{{ item.photo }}"
style="border-radius: 22px;">
</div>
<p></p>
@ -184,11 +184,11 @@
{% if current_user.is_authenticated %}
<div class="like">
<a type="button"
href="/new_like/{{current_user.id}}/{{item.id}}/publications">
href="/diary/new_like/{{current_user.id}}/{{item.id}}/publications">
{% if emotion_fresh[loop.index0]['is_like'] %}
<img src="../static/img/like_add.png" width="117" height="100">
<img src="../../static/img/like_add.png" width="117" height="100">
{% else %}
<img src="../static/img/like.png" width="94" height="80">
<img src="../../static/img/like.png" width="94" height="80">
{% endif %}
</a>
{% if emotion_fresh[loop.index0]['like'] != None %}
@ -213,14 +213,14 @@
{% endif %}
<div class="author" style="style=position:absolute; width:148px; height:44px; left:255px; -webkit-border-radius:
22px;-moz-border-radius: 22px;border-radius: 22px; border:2px solid #FFFFFF; background-color:#1daff0; top:
98px;"><img src="../{{ emotion_fresh[loop.index0]['author'].photo }}" width="40" height="40"
98px;"><img src="../../{{ emotion_fresh[loop.index0]['author'].photo }}" width="40" height="40"
style="border-radius: 22px">
<strong style="color: #ffffff">{{ emotion_fresh[loop.index0]['author'].name }}</strong>
</div>
<strong style="color:#ffffff">{{item.date}}</strong>
{% if current_user.is_authenticated %}
{% if current_user.role == 'admin' %}
<a style="border-radius: 15px;" href="/post_deleted/{{ item.id }}" class="btn btn-danger">
<a style="border-radius: 15px;" href="/diary/post_deleted/{{ item.id }}" class="btn btn-danger">
Удалить
</a>
{% endif %}
@ -284,7 +284,7 @@
{% if item.photo != None %}
<p></p>
<div class="photo">
<img width="90%" src="{{ item.photo }}"
<img width="90%" src="../../{{ item.photo }}"
style="border-radius: 22px;">
</div>
<p></p>
@ -292,11 +292,11 @@
{% if current_user.is_authenticated %}
<div class="like">
<a type="button"
href="/new_like/{{current_user.id}}/{{item.id}}/publications">
href="/diary/new_like/{{current_user.id}}/{{item.id}}/publications">
{% if emotion_for_you[loop.index0]['is_like'] %}
<img src="../static/img/like_add.png" width="117" height="100">
<img src="../../static/img/like_add.png" width="117" height="100">
{% else %}
<img src="../static/img/like.png" width="94" height="80">
<img src="../../static/img/like.png" width="94" height="80">
{% endif %}
</a>
{% if emotion_for_you[loop.index0]['like'] != None %}
@ -321,7 +321,7 @@
{% endif %}
<div class="author" style="style=position:absolute; width:148px; height:44px; left:255px; -webkit-border-radius:
22px;-moz-border-radius: 22px;border-radius: 22px; border:2px solid #FFFFFF; background-color:#1daff0; top:
98px;"><img src="../{{ emotion_for_you[loop.index0]['author'].photo }}" width="40" height="40"
98px;"><img src="../../{{ emotion_for_you[loop.index0]['author'].photo }}" width="40" height="40"
style="border-radius: 22px">
<strong style="color: #ffffff">{{ emotion_for_you[loop.index0]['author'].name }}</strong>
</div>
@ -329,7 +329,7 @@
{% if current_user.is_authenticated %}
{% if current_user.role == 'admin' %}
<a style="border-radius: 15px;" href="/post_deleted/{{ item.id }}" class="btn btn-danger">
<a style="border-radius: 15px;" href="/diary/post_deleted/{{ item.id }}" class="btn btn-danger">
Удалить
</a>
{% endif %}

View File

@ -1,6 +1,6 @@
<meta charset="UTF-8">
<link rel="stylesheet" href="../static/css/register.css">
{% extends "base.html" %}
<link rel="stylesheet" href="../static/css/diary/register.css">
{% extends "diary/base.html" %}
{% block content %}
<div class="divlog">
<h1 class="title">Восстановление пароля</h1>

View File

@ -1,5 +1,5 @@
<link rel="stylesheet" href="../static/css/register.css">
{% extends "base.html" %}
<link rel="stylesheet" href="../../static/css/diary/register.css">
{% extends "diary/base.html" %}
{% block content %}
<div class="divlog">
<h1 class="title">Регистрация</h1>

49
templates/main/main.html Normal file
View File

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
crossorigin="anonymous">
<link rel="icon" href="../static/img/MoonCcircl.ico" type="image/x-icon">
<link href="https://fonts.googleapis.com/css2?family=Comfortaa:wght@700&family=Montserrat+Alternates:wght@600&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="../../static/css/main/main.css">
<title>Добро пожаловать</title>
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-u1OknCvxWvY5kfmNBILK2hRnQC3Pr17a+RTT6rIHI7NnikvbZlHgTPOOmMi466C8"
crossorigin="anonymous"></script>
<div class="alert alert-danger" role="alert">
<h4 style="text-align:center;">Сайт находится на доработке и может работать некорректно :)</h4>
</div>
<div class="header">
<img class="header_logo" src="../../static/img/string_moona_no_back.png" width="50%">
<h2 class="header_title">Добро пожаловать в Moona! Мы всегда рады предоставить вам наши сервисы :з</h2>
</div>
<a href="/diary">
<div class="article_one">
<div class="article_one_text_back">
<p class="article_one_text">Наш первый сервис - это личный дневник, вы можете создавать посты и выкладывать
их
или оставить приватными, если хотите посекретничать :З</p>
</div>
<img class="article_one_image img-thumbnail" src="../../static/img/MoonCcircl.png">
</div>
</a>
<a>
<div class="article_two">
<img class="article_two_image img-thumbnail" src="../../static/img/maps.png">
<div class="article_two_text_back">
<p class="article_two_text">
Второй наш сервис позволяет вам строить безопасные пешеходные маршруты нажатием одной кнопки (работает
на
яндекс картах)
</p>
</div>
</div>
</a>
</body>
</html>

View File

@ -9,8 +9,8 @@
<link rel="icon" href="../static/img/MoonCcircl.ico" type="image/x-icon">
<link href="https://fonts.googleapis.com/css2?family=Comfortaa:wght@700&family=Montserrat+Alternates:wght@600&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="../static/css/base.css">
<link rel="stylesheet" href="../static/css/simple_can_close.css">
<link rel="stylesheet" href="../../static/css/diary/base.css">
<link rel="stylesheet" href="../../static/css/diary/simple_can_close.css">
<title>{{title}}</title>
</head>
<body>

View File

@ -9,8 +9,8 @@
<link rel="icon" href="../static/img/MoonCcircl.ico" type="image/x-icon">
<link href="https://fonts.googleapis.com/css2?family=Comfortaa:wght@700&family=Montserrat+Alternates:wght@600&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="../static/css/base.css">
<link rel="stylesheet" href="../static/css/register.css">
<link rel="stylesheet" href="../../static/css/diary/base.css">
<link rel="stylesheet" href="../../static/css/diary/register.css">
<title>{{title}}</title>
</head>
<body>

View File

@ -9,8 +9,8 @@
<link rel="icon" href="../static/img/MoonCcircl.ico" type="image/x-icon">
<link href="https://fonts.googleapis.com/css2?family=Comfortaa:wght@700&family=Montserrat+Alternates:wght@600&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="../static/css/base.css">
<link rel="stylesheet" href="../static/css/register.css">
<link rel="stylesheet" href="../../static/css/diary/base.css">
<link rel="stylesheet" href="../../static/css/diary/register.css">
<title>{{title}}</title>
</head>
<div class="divlog">