diff --git a/main.log b/main.log index e69de29..4fe5036 100644 --- a/main.log +++ b/main.log @@ -0,0 +1,24 @@ +WARNING:waitress.queue:Task queue depth is 1 +WARNING:waitress.queue:Task queue depth is 2 +WARNING:waitress.queue:Task queue depth is 1 +WARNING:waitress.queue:Task queue depth is 1 +WARNING:waitress.queue:Task queue depth is 1 +WARNING:waitress.queue:Task queue depth is 1 +WARNING:waitress.queue:Task queue depth is 1 +WARNING:waitress.queue:Task queue depth is 1 +WARNING:waitress.queue:Task queue depth is 1 +WARNING:waitress.queue:Task queue depth is 1 +WARNING:waitress.queue:Task queue depth is 1 +WARNING:waitress.queue:Task queue depth is 1 +WARNING:waitress.queue:Task queue depth is 1 +WARNING:waitress.queue:Task queue depth is 1 +WARNING:waitress.queue:Task queue depth is 1 +WARNING:waitress.queue:Task queue depth is 1 +WARNING:waitress.queue:Task queue depth is 1 +WARNING:waitress.queue:Task queue depth is 1 +WARNING:waitress.queue:Task queue depth is 1 +WARNING:waitress.queue:Task queue depth is 1 +WARNING:waitress.queue:Task queue depth is 1 +WARNING:waitress.queue:Task queue depth is 1 +WARNING:waitress.queue:Task queue depth is 1 +WARNING:waitress.queue:Task queue depth is 1 diff --git a/main.py b/main.py index 50ee47a..ebd2692 100644 --- a/main.py +++ b/main.py @@ -72,104 +72,7 @@ def load_user(user_id): @app.route('/') def main_page(): - session = db_session.create_session() - for_you = sorted(session.query(DiaryPost).filter(DiaryPost.public == 1).all(), - key=lambda x: (len(x.text), 1 if x.photo else 0, -(x.date - datetime.datetime.now()).days)) - if len(for_you) > 50: - for_you_post = choices(for_you, k=80) - else: - for_you_post = set(for_you) - emotion_for_you = [] - for i in for_you_post: - emotion = {id: i.id, 'pos_emot': [], 'nig_emot': [], 'link': [], - 'author': session.query(User).filter(User.id == i.author).first(), 'like': None, 'is_like': 0} - if i.pos_emot: - emotion['pos_emot'] = i.pos_emot.split() - else: - emotion['pos_emot'] = None - if i.nig_emot: - emotion['nig_emot'] = i.nig_emot.split() - else: - emotion['nig_emot'] = None - if i.link: - emotion['link'] = i.link.split() - else: - emotion['link'] = None - like = session.query(Like).filter(Like.post == i.id).all() - if like: - emotion['like'] = len(like) - if current_user.is_authenticated: - if session.query(Like).filter(Like.post == i.id, Like.user == current_user.id).first(): - emotion['is_like'] = 1 - emotion_for_you.append(emotion) - if current_user.is_authenticated: - try: - you_like_that = sorted( - list(map(lambda x: session.query(DiaryPost).filter(DiaryPost.id == x, DiaryPost.public == 1).first(), - map(lambda x: x.post, - session.query(Like).filter(Like.user == current_user.id).all()))), - key=lambda x: ( - len(x.text), 1 if x.photo else 0, -(x.date - datetime.datetime.now()).days)) - except Exception: - you_like_that = [] - emotion_you_like_that = [] - for i in you_like_that: - emotion = {id: i.id, 'pos_emot': [], 'nig_emot': [], 'link': [], - 'author': session.query(User).filter(User.id == i.author).first(), 'like': None, 'is_like': 0} - if i.pos_emot: - emotion['pos_emot'] = i.pos_emot.split() - else: - emotion['pos_emot'] = None - if i.nig_emot: - emotion['nig_emot'] = i.nig_emot.split() - else: - emotion['nig_emot'] = None - if i.link: - emotion['link'] = i.link.split() - else: - emotion['link'] = None - like = session.query(Like).filter(Like.post == i.id).all() - if like: - emotion['like'] = len(like) - if current_user.is_authenticated: - if session.query(Like).filter(Like.post == i.id, Like.user == current_user.id).first(): - emotion['is_like'] = 1 - emotion_you_like_that.append(emotion) - quest = session.query(Answer).filter(Answer.user == current_user.id).all() - try: - days_reg = current_user.data_reg - datetime.date.today() - days_reg = abs(days_reg.days) + 1 - if quest: - post_quest = session.query(Quest).filter(Quest.id.in_([i.id_question for i in quest])).all() - else: - post_quest = [] - max_quests = len(session.query(Quest).all()) - while len(post_quest) < days_reg and max_quests > len(post_quest): - post_quest.append( - session.query(Quest).filter(Quest.id.notin_([i.id for i in post_quest])).first()) - ans = [] - for i in post_quest: - if i is not None: - ans_id = session.query(Answer).filter( - Answer.id_question == i.id, Answer.user == current_user.id).first() - if ans_id is not None: - ans.append(ans_id) - post_quest = post_quest[::-1] - ans = ans[::-1] - ans2 = {} - for i in ans: - ans2[i.id_question] = i - except Exception: - ans2 = [] - else: - you_like_that = [] - emotion_you_like_that = None - post_quest = [] - ans2 = None - return render_template('main.html', title='moona', for_me_post=for_you_post, emotion_for_you=emotion_for_you, - you_like_that=you_like_that, emotion_you_like_that=emotion_you_like_that, - question=post_quest, - ans=ans2) + return render_template('main.html', title='moona') @app.route('/edit_profile/', methods=['GET', 'POST']) diff --git a/static/css/base.css b/static/css/base.css index f6191d2..497a36f 100644 --- a/static/css/base.css +++ b/static/css/base.css @@ -1,8 +1,9 @@ .navbar-brand { font-family: 'Montserrat Alternates', sans-serif; + background-color: #f0ffff; } body { - font-family: 'Comfortaa', cursive; + font-family: 'Comfortaa', cursive, sans-serif; background-color: #f0ffff; } .user_img { diff --git a/static/css/main.css b/static/css/main.css index bf4c0c3..b60aa0f 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -1,49 +1,50 @@ -#add_post { - margin-top: 20px; - margin-left: 83%; +body { + background-image: url('../img/back_moona.png'); } -.row1, .row2, .row3 { - width: 33%; - display:inline-block; - vertical-align: top; - margin-top: 39px; -} -.rowdiv1, .rowdiv2, .rowdiv3 { - width: 95%; -} -.post_zag, .card-text, .card-body, .post_zag, .author { - width: 90%; +.header, .body { + width: 80%; 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; } -.post { - background-color: #7fc3ff; - border-radius: 50px; - width: 90%; - height: 95%; - margin-bottom: 20px; +.article_one { + width: 100%; + height: 27%; + max-height: 27%; + display: flex; + justify-content: space-around; } -details { - color: #ffffff; -} -#main_table { - margin-left: 10%; - margin-right: auto; - width: 90%; -} -.question { - background-color:#7fc3ff; +.article_one_text_back { + width: 50%; + background: linear-gradient(45deg, #d1c3fc, #9bc4fc); border-radius: 22px; - width: 90%; - margin-left: 10px; + height: 94%; } -.is_ans { - background-color:#ddefff; - border:2px solid #ffffff; - border-radius: 25px; - width: 95%; +.article_one_text { + width: 94%; + height: 94%; + margin-top: 3%; + margin-left: 3%; + overflow: auto; + color: white; + text-align: justify; } -.but { - width: 80%; +.article_one_image { + height: 100%; } \ No newline at end of file diff --git a/static/img/Надпись Moona без фона.png b/static/img/Надпись Moona без фона.png deleted file mode 100644 index 25059b9..0000000 Binary files a/static/img/Надпись Moona без фона.png and /dev/null differ diff --git a/static/img/НадписьMoona.png b/static/img/НадписьMoona.png deleted file mode 100644 index 12af101..0000000 Binary files a/static/img/НадписьMoona.png and /dev/null differ diff --git a/templates/main.html b/templates/main.html index 452b6a0..1aaf418 100644 --- a/templates/main.html +++ b/templates/main.html @@ -2,259 +2,18 @@ {% extends "base.html" %} {% block content %} - - - - {% if current_user.is_authenticated %} - - {% endif %} - -
-

Главная

-
- Добавить - запись -
- - - - -
-
-

Вопросы дня

-
- -
+
+ +

Добро пожаловать в moona - ваш проводник в мир оптимизма, дружелюбия и единения!

+
+
+
+
+

У всех нас бывают черные и белые полосы, хорошее и плохое настроение, мы переживаем плохие моменты нашей + жизни и радуемся приятным мелочам. Однако многие не знают или забывают про такую вещь, как личный дневник, а + ведь у него есть множество плюсов

-
-
-

Вам будет интересно

- {% if for_me_post != [] %} - {% for item in for_me_post %} -
-
- - {% if item.name != None %} -

{{item.name}}

- {% endif %} -
- {% if item.text != None %} - {{item.text}} - {% endif %} -
- {% if emotion_for_you[loop.index0]['pos_emot'] != None %} -
-
- - Позитивные эмоции - -

- {% for item2 in emotion_for_you[loop.index0]['pos_emot'] %} - - {% endfor %} -
-
-

- {% endif %} - {% if emotion_for_you[loop.index0]['nig_emot'] != None %} -
-
- - Негативные эмоции - -

- {% for item2 in emotion_for_you[loop.index0]['nig_emot'] %} - - {% endfor %} -
-
-

- {% endif %} - {% if item.photo != None %} -

-
- -
-

- {% endif %} - {% if current_user.is_authenticated %} - - {% endif %} - {% if emotion_for_you[loop.index0]['link'] != None %} -
- - Ссылки - -

- {% for item2 in emotion_for_you[loop.index0]['link'] %} - -

- {% endfor %} -
- {% endif %} -
- {{ emotion_for_you[loop.index0]['author'].name }} -
- {{item.date}} - {% if current_user.is_authenticated %} - {% if current_user.role == 'admin' %} - - Удалить - - {% endif %} - {% endif %} -
- {% endfor %} - {% else %} -
-

Ничего не нашлось :с

-
- {% endif %} -
-
-
-

Вам понравились эти посты

- {% if you_like_that != [] %} - {% for item in you_like_that %} -
-
- - {% if item.name != None %} -

{{item.name}}

- {% endif %} -
- {% if item.text != None %} - {{item.text}} - {% endif %} -
- {% if emotion_you_like_that[loop.index0]['pos_emot'] != None %} -
-
- - Позитивные эмоции - -

- {% for item2 in emotion_you_like_that[loop.index0]['pos_emot'] %} - - {% endfor %} -
-
-

- {% endif %} - {% if emotion_you_like_that[loop.index0]['nig_emot'] != None %} -
-
- - Негативные эмоции - -

- {% for item2 in emotion_you_like_that[loop.index0]['nig_emot'] %} - - {% endfor %} -
-
-

- {% endif %} - {% if item.photo != None %} -

-
- -
-

- {% endif %} - {% if current_user.is_authenticated %} - - {% endif %} - {% if emotion_you_like_that[loop.index0]['link'] != None %} -
- - Ссылки - -

- {% for item2 in emotion_you_like_that[loop.index0]['link'] %} - -

- {% endfor %} -
- {% endif %} -
- {{ emotion_you_like_that[loop.index0]['author'].name }} -
- {{item.date}} - {% if current_user.is_authenticated %} - {% if current_user.role == 'admin' %} - - Удалить - - {% endif %} - {% endif %} -
- {% endfor %} - {% else %} -
-

Ничего не нашлось :с

-
- {% endif %} -
-
+ + + {% endblock %} \ No newline at end of file