-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathurls.py
41 lines (31 loc) · 962 Bytes
/
urls.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from flask import Flask, request, jsonify, render_template, request
# from flask.ext.scss import Scss
from flask.ext.assets import Environment, Bundle
from images import get_images
import logging
import json
app = Flask(__name__)
assets = Environment(app)
assets.url = app.static_url_path
# assets.url = app.static_url_path
scss = Bundle('scss/main.scss', filters='pyscss', output='css/all.css')
assets.register('scss_all', scss)
# Scss(app, static_dir='static', asset_dir='assets')
app.debug = True
@app.route('/')
def index():
return render_template('index.html')
@app.route('/images/<int:start_index>')
def get_images_api(start_index):
try:
if start_index:
start_index = int(start_index)
else:
start_index = 0
images = get_images(start_index=start_index)
return jsonify(data=images)
except:
logging.exception("error")
raise
if __name__ == '__main__':
app.run()