This commit is contained in:
thematdev 2020-12-27 10:46:48 +03:00
parent 30a21270e3
commit d10580a0ee
3 changed files with 10 additions and 20 deletions

13
main.py
View File

@ -5,7 +5,7 @@ import numpy.random as gaussian_rnd
app = Flask(__name__, subdomain_matching=True)
app.config['SERVER_NAME'] = 'thematdev.local:22837'
app.config['SERVER_NAME'] = '192.168.51.3:1488'
def generate_iq():
@ -32,15 +32,8 @@ def index():
data = json.loads(file.read())
cols = data['cols']
projects = data['projects']
length = len(projects)
rows = []
for i in range(0, length, cols):
row = []
for j in range(i, min(i + cols, length)):
row.append(projects[j])
rows.append(row)
return render_template('index.html', random_number=generate_iq(), rows=rows)
return render_template('index.html', random_number=generate_iq(), projects=projects)
@app.route('/', subdomain='tex')
@ -49,7 +42,7 @@ def texindex():
def main():
app.run('thematdev.local', 22837)
app.run('192.168.51.3', 1488)
if __name__ == '__main__':

View File

@ -99,7 +99,8 @@ body {
.project-container {
position: inherit;
display: flex;
flex-direction: column;
flex-direction: row;
flex-wrap: wrap;
}
.project-container-row {

View File

@ -28,9 +28,7 @@
<div class="pagebody-inner-section" id="pbi">
<h1>Мои проекты</h1>
<div class="project-container" id="pbic">
{% for row in rows %}
<div class="project-container-row">
{% for project in row %}
{% for project in projects %}
<div class="project-element">
<h1> {{ project.title }}</h1>
<img src="{{ url_for('static', filename='assets/{0}'.format(project.image))}}" width=200 height=200>
@ -38,8 +36,6 @@
</div>
{% endfor %}
</div>
{% endfor %}
</div>
</div>
</div>
<script src="{{ url_for('static', filename='js/projects.js') }}"></script>