first commit
This commit is contained in:
commit
500cb439b8
|
@ -0,0 +1 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?><sqlb_project><db path="/home/yurec/flask/bd/db.db" readonly="0" foreign_keys="" case_sensitive_like="" temp_store="" wal_autocheckpoint="" synchronous=""/><attached/><window><main_tabs open="structure browser pragmas query" current="1"/></window><tab_structure><column_width id="0" width="300"/><column_width id="1" width="0"/><column_width id="2" width="100"/><column_width id="3" width="1362"/><column_width id="4" width="0"/></tab_structure><tab_browse><current_table name="0,0:"/><default_encoding codec=""/><browse_table_settings/></tab_browse><tab_sql><sql name="SQL 1">INSERT INTO `users` (`email`, `pwd`, `site`) VALUES ("yurec@yurecnt.ru", "123", "localhost")</sql><current_tab id="0"/></tab_sql></sqlb_project>
|
|
@ -0,0 +1,56 @@
|
||||||
|
from flask import Flask
|
||||||
|
from flask import render_template
|
||||||
|
from flask import request
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
@app.route('/')
|
||||||
|
def main_mod(module='main'):
|
||||||
|
o = urlparse(request.base_url)
|
||||||
|
myhost=o.hostname
|
||||||
|
myhost=o.hostname
|
||||||
|
module2="mod."+module + ".index"
|
||||||
|
mod = __import__(module2)
|
||||||
|
a=getattr(mod, module)
|
||||||
|
b=getattr(a, 'index')
|
||||||
|
if request.method=='POST':
|
||||||
|
do=b.do(id)
|
||||||
|
else:
|
||||||
|
go=b.mod(id, myhost)
|
||||||
|
# help(b)
|
||||||
|
result=b.mod.result
|
||||||
|
print(result)
|
||||||
|
return render_template(myhost + "/" + module+'.html', massiv=result, myhost=myhost)
|
||||||
|
|
||||||
|
@app.route('/<module>')
|
||||||
|
def short_mod(module='main'):
|
||||||
|
module="mod."+module
|
||||||
|
__import__(module)
|
||||||
|
return str(module)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/<module>/<id>', methods=['GET', 'POST'])
|
||||||
|
def mod(id, module='page'):
|
||||||
|
o = urlparse(request.base_url)
|
||||||
|
myhost=o.hostname
|
||||||
|
module2="mod."+module + ".index"
|
||||||
|
mod = __import__(module2)
|
||||||
|
a=getattr(mod, module)
|
||||||
|
b=getattr(a, 'index')
|
||||||
|
if request.method=='POST':
|
||||||
|
do=b.do(id)
|
||||||
|
else:
|
||||||
|
go=b.mod(id, myhost)
|
||||||
|
# help(b)
|
||||||
|
result=b.mod.result
|
||||||
|
print(result)
|
||||||
|
return render_template(myhost + "/" + module+'.html', massiv=result, myhost=myhost)
|
||||||
|
#return str(module)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app.run(host='0.0.0.0', debug=True)
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,5 @@
|
||||||
|
class mod:
|
||||||
|
def __init__(self, id):
|
||||||
|
print("test" + id)
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,22 @@
|
||||||
|
class mod:
|
||||||
|
result="123"
|
||||||
|
def __init__(self, id, myhost):
|
||||||
|
import mod.sqlite.index
|
||||||
|
self.sql=mod.sqlite.index.sqlite()
|
||||||
|
#self.sql.install("users", "json")
|
||||||
|
self.sql.newtable('''
|
||||||
|
CREATE TABLE IF NOT EXISTS settings (
|
||||||
|
id INTEGER,
|
||||||
|
json TEXT NOT NULL,
|
||||||
|
site TEXT NOT NULL,
|
||||||
|
mod TEXT NOT NULL,
|
||||||
|
PRIMARY KEY(id AUTOINCREMENT));
|
||||||
|
''')
|
||||||
|
|
||||||
|
self.getPage(id, myhost)
|
||||||
|
|
||||||
|
def getPage(self, id, myhost):
|
||||||
|
#self.sql.cur.execute("SELECT * FROM content WHERE id=" + id + " AND type='page' AND site='" + myhost + "' LIMIT 1")
|
||||||
|
#result = self.sql.cur.fetchone()
|
||||||
|
mod.result="main_mod"
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,42 @@
|
||||||
|
class mod:
|
||||||
|
result="123"
|
||||||
|
def __init__(self, id, myhost):
|
||||||
|
import mod.sqlite.index
|
||||||
|
self.sql=mod.sqlite.index.sqlite()
|
||||||
|
self.sql.install("users", "json")
|
||||||
|
self.sql.newtable('''
|
||||||
|
CREATE TABLE IF NOT EXISTS content (
|
||||||
|
id INTEGER,
|
||||||
|
title TEXT NOT NULL,
|
||||||
|
txt TEXT NOT NULL,
|
||||||
|
short_txt TEXT NOT NULL,
|
||||||
|
user_id INTEGER,
|
||||||
|
status INTEGER NOT NULL DEFAULT 1,
|
||||||
|
content_category INTEGER NOT NULL DEFAULT 0,
|
||||||
|
keywords TEXT,
|
||||||
|
description TEXT,
|
||||||
|
site TEXT,
|
||||||
|
json TEXT,
|
||||||
|
PRIMARY KEY(id AUTOINCREMENT));
|
||||||
|
''')
|
||||||
|
self.sql.newtable('''
|
||||||
|
CREATE TABLE IF NOT EXISTS content_category (
|
||||||
|
id INTEGER, category INTEGER,
|
||||||
|
title TEXT NOT NULL,
|
||||||
|
txt TEXT NOT NULL,
|
||||||
|
user_id INTEGER,
|
||||||
|
status INTEGER NOT NULL DEFAULT 1,
|
||||||
|
description TEXT,
|
||||||
|
keywords TEXT,
|
||||||
|
site TEXT,
|
||||||
|
json TEXT,
|
||||||
|
PRIMARY KEY(id AUTOINCREMENT));''')
|
||||||
|
self.sql.install("content", "type")
|
||||||
|
self.sql.install("content", "alias")
|
||||||
|
self.getPage(id, myhost)
|
||||||
|
|
||||||
|
def getPage(self, id, myhost):
|
||||||
|
self.sql.cur.execute("SELECT * FROM content WHERE id=" + id + " AND type='page' AND site='" + myhost + "' LIMIT 1")
|
||||||
|
result = self.sql.cur.fetchone()
|
||||||
|
mod.result=result
|
||||||
|
return result
|
Binary file not shown.
|
@ -0,0 +1,25 @@
|
||||||
|
import sqlite3
|
||||||
|
|
||||||
|
class sqlite:
|
||||||
|
def __init__(self):
|
||||||
|
conn = sqlite3.connect('bd/db.db')
|
||||||
|
self.cur=conn.cursor()
|
||||||
|
#self.cur.execute("SELECT * FROM users;")
|
||||||
|
#one_result = self.cur.fetchone()
|
||||||
|
#print(one_result)
|
||||||
|
|
||||||
|
def install(self, tab, pole):
|
||||||
|
try:
|
||||||
|
self.cur.execute("ALTER TABLE " + tab + " ADD COLUMN " + pole)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def newtable(self, txt):
|
||||||
|
try:
|
||||||
|
self.cur.execute(txt)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
#https://nizhniy-tagil.leader-t.ru/catalog/zashchita-ruk/
|
||||||
|
#https://nizhniy-tagil.leader-t.ru/catalog/obtirochnye-materialy/
|
||||||
|
#https://nizhniy-tagil.leader-t.ru/catalog/rukavitsy/
|
|
@ -0,0 +1,7 @@
|
||||||
|
body *{
|
||||||
|
border: 0px solid lightgrey;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-mini{
|
||||||
|
padding: 0px;
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 4.5 MiB |
Binary file not shown.
After Width: | Height: | Size: 133 KiB |
|
@ -0,0 +1,52 @@
|
||||||
|
{% extends "localhost/template.html" %}
|
||||||
|
{% block body %}
|
||||||
|
<section class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3"></div>
|
||||||
|
<div class="col-md-9">
|
||||||
|
<div id="carouselExampleCaptions" class="carousel slide">
|
||||||
|
<div class="carousel-indicators">
|
||||||
|
<button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button>
|
||||||
|
<button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="1" aria-label="Slide 2"></button>
|
||||||
|
<button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="2" aria-label="Slide 3"></button>
|
||||||
|
</div>
|
||||||
|
<div class="carousel-inner">
|
||||||
|
<div class="carousel-item active">
|
||||||
|
<img src="/static/img/localhost/slider/s1-800-600.jpg" class="d-block w-100" alt="...">
|
||||||
|
<div class="carousel-caption d-none d-md-block">
|
||||||
|
<h5>Метка первого слайда</h5>
|
||||||
|
<p>Некоторый репрезентативный заполнитель для первого слайда.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="carousel-item">
|
||||||
|
<img src=".." class="d-block w-100" alt="...">
|
||||||
|
<div class="carousel-caption d-none d-md-block">
|
||||||
|
<h5>Метка второго слайда</h5>
|
||||||
|
<p>Некоторый репрезентативный заполнитель для второго слайда.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="carousel-item">
|
||||||
|
<img src="..." class="d-block w-100" alt="...">
|
||||||
|
<div class="carousel-caption d-none d-md-block">
|
||||||
|
<h5>Метка третьего слайда</h5>
|
||||||
|
<p>Некоторый репрезентативный заполнитель для третьего слайда.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide="prev">
|
||||||
|
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
|
||||||
|
<span class="visually-hidden">Предыдущий</span>
|
||||||
|
</button>
|
||||||
|
<button class="carousel-control-next" type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide="next">
|
||||||
|
<span class="carousel-control-next-icon" aria-hidden="true"></span>
|
||||||
|
<span class="visually-hidden">Следующий</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
{% endblock %}
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
|
||||||
|
{% extends "localhost/template.html" %}
|
||||||
|
{% block body %}
|
||||||
|
<article class="container">
|
||||||
|
{{massiv.2}}
|
||||||
|
</article>
|
||||||
|
{% endblock %}
|
|
@ -0,0 +1,89 @@
|
||||||
|
<!doctype html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>{{myhost}} - {{massiv.1}}</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||||
|
integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">
|
||||||
|
<link rel=stylesheet type=text/css href="/static/domen/css/css.css">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="container-fluid" style="padding: 0px; margin:0px;">
|
||||||
|
<header class="header-mini container-fluid">
|
||||||
|
<nav class="navbar navbar-expand-lg bg-body-tertiary">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<a href="/"><img
|
||||||
|
src="https://static.insales-cdn.com/files/1/3445/30117237/original/logo_cdc37caa861a11dbf0d404b2b1bdc464.png"
|
||||||
|
style="width: 200px;"></a>
|
||||||
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent"
|
||||||
|
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Переключатель навигации">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||||
|
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" aria-current="page" href="#">Главная</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="#">Ссылка</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item dropdown">
|
||||||
|
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"
|
||||||
|
aria-expanded="false">
|
||||||
|
Выпадающий список
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a class="dropdown-item" href="#">Действие</a></li>
|
||||||
|
<li><a class="dropdown-item" href="#">Другое действие</a></li>
|
||||||
|
<li>
|
||||||
|
<hr class="dropdown-divider">
|
||||||
|
</li>
|
||||||
|
<li><a class="dropdown-item" href="#">Что-то еще здесь</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<form class="d-flex" role="search">
|
||||||
|
<input class="form-control me-2" type="search" placeholder="Поиск" aria-label="Поиск">
|
||||||
|
<button class="btn btn-outline-success" type="submit">Поиск</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<section class="container">
|
||||||
|
<h1>{{massiv.1}}</h1>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{% block body %}{% endblock %}
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script src="https://new.yurecnt.ru/api/jquery/plugins/lazyload/jquery.lazyload.min1.9.5.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js"
|
||||||
|
integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class=page>
|
||||||
|
|
||||||
|
<div class=metanav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
Loading…
Reference in New Issue