File tree Expand file tree Collapse file tree 7 files changed +225
-4
lines changed Expand file tree Collapse file tree 7 files changed +225
-4
lines changed Original file line number Diff line number Diff line change 11.python-version
22.venv
3- .idea
3+ .idea
Original file line number Diff line number Diff line change 11import os
2- from flask import Flask
2+ from flask import Flask , render_template
33from dotenv import load_dotenv
44
55load_dotenv ()
99
1010@app .route ('/' )
1111def index ():
12- return "Hello, World!"
12+ return render_template ('index.html' )
13+
14+ @app .route ('/urls' )
15+ def all_urls ():
16+ pass
17+
18+ @app .route ('/urls' , methods = ['POST' ])
19+ def add_url ():
20+ pass
1321
1422__all__ = ['app' ]
1523if __name__ == '__main__' :
Original file line number Diff line number Diff line change 1+ {% extends 'layout.html' %}
2+ {% block sidebar %}
3+ {% with messages = get_flashed_messages(with_categories=true) %}
4+ {% if messages %}
5+ < div >
6+ {% for category, message in messages %}
7+ < div class ="alert alert-{{ category }} " role ="alert ">
8+ {{ message }}
9+ </ div >
10+ {% endfor %}
11+ </ div >
12+ {% endif %}
13+ {% endwith %}
14+ {% endblock sidebar %}
15+ {% block content %}
16+ <!--Главная форма-->
17+ < body >
18+ < div class ="container py-3 ">
19+ < div class ="col-12 col-md-11 col-lg-8 mx-auto border rounded-3 bg-light p-5 ">
20+ < h1 class ="display-3 "> Анализатор страниц</ h1 >
21+ < p class ="lead "> Бесплатно проверяйте сайты на SEO-пригодность</ p >
22+ < form action ="{{ url_for('add_url') }} " method ="post " class ="d-flex justify-content-center ">
23+ < div class ="input-group input-group-lg ">
24+ < input
25+ type ="url "
26+ name ="url "
27+ value ="{{ url if url is defined else '' }} "
28+ placeholder ="https://www.example.com "
29+ class ="form-control form-control-lg "
30+ required
31+ >
32+ < input type ="submit " value ="Проверить " class ="btn btn-primary btn-lg ms-3 px-5 text-uppercase mx-2 ">
33+ </ div >
34+ </ form >
35+ </ div >
36+ </ div >
37+ </ body >
38+ {% endblock %}
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6+ < title > Анализатор страниц</ title >
7+ < link href ="
https://cdn.jsdelivr.net/npm/[email protected] /dist/css/bootstrap.min.css "
rel ="
stylesheet "
> 8+ </ head >
9+ < body >
10+ <!--Шапка страницы-->
11+ < header >
12+ < nav class ="navbar navbar-expand-md navbar-dark bg-dark px-1 ">
13+ < div class ="container-fluid ">
14+ < a class ="navbar-brand " href ="{{ url_for('index') }} "> Анализатор страниц</ a >
15+ < button class ="navbar-toggler " type ="button " data-bs-toggle ="collapse " data-bs-target ="#navbarNav " aria-controls ="navbarNav " aria-expanded ="false " aria-label ="Переключатель навигации ">
16+ </ button >
17+ < div class ="collapse navbar-collapse " id ="navbarNav ">
18+ < ul class ="navbar-nav ">
19+ < li class ="nav-item ">
20+ < a class ="nav-link active " aria-current ="page " href ="{{ url_for('all_urls') }} "> Сайты</ a >
21+ </ li >
22+ </ ul >
23+ </ div >
24+ </ div >
25+ </ nav >
26+ </ header >
27+ {% block sidebar %}{% endblock sidebar %}
28+ < main class ="flex-grow-1 ">
29+ < div id ="content " class ="container-lg mt-3 ">
30+ {% block content %}{% endblock %}
31+ </ div >
32+ </ main >
33+
34+ <!--форма внизу-->
35+ < footer class ="text-black p-3 fixed-bottom ">
36+ < div class ="w-100 border-top border-secondary opacity-25 mb-3 "> </ div >
37+ < div class ="container text-center ">
38+ < a href ="https://ru.hexlet.io/ "> Hexlet</ a >
39+ </ div >
40+ </ footer >
41+ </ body >
42+ </ html >
Original file line number Diff line number Diff line change 1+ {% extends 'layout.html' %}
2+
3+ {% block content %}
4+ < div class ="container mt-5 ">
5+ < h1 class ="mb-4 "> Сайты</ h1 >
6+ < table data-test ="urls " class ="table table-bordered table-hover ">
7+ < thead class ="table-light ">
8+ < tr >
9+ < th > ID</ th >
10+ < th > Имя</ th >
11+ < th > Последняя проверка</ th >
12+ < th > Код ответа</ th >
13+ </ tr >
14+ </ thead >
15+ < tbody >
16+ {% for url in urls %}
17+ < tr >
18+ < td > {{ url.id }}</ td >
19+ < td > < a href ="{{ url_for('url_detail', id=url.id) }} "> {{ url.name }}</ a > </ td >
20+ < td > {{ url.last_check.strftime('%d-%m-%Y %H:%M') if url.last_check else 'Ещё не проверялся' }}</ td >
21+ < td > {{ url.status_code if url.status_code else '' }}</ td >
22+ </ tr >
23+ {% endfor %}
24+ </ tbody >
25+ </ table >
26+ </ div >
27+ {% endblock %}
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ requires-python = ">=3.10"
77dependencies = [
88 " flask>=3.1.0" ,
99 " gunicorn>=23.0.0" ,
10+ " pytest>=8.3.5" ,
1011 " python-dotenv>=1.1.0" ,
1112 " ruff>=0.11.7" ,
1213]
You can’t perform that action at this time.
0 commit comments