-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver.py
More file actions
36 lines (30 loc) · 806 Bytes
/
server.py
File metadata and controls
36 lines (30 loc) · 806 Bytes
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
"""Sample application template in Python"""
import os
from algoliasearch.search_client import SearchClient
from dotenv import load_dotenv, find_dotenv
from flask import Flask, render_template
load_dotenv(find_dotenv())
# Setup the Algolia client
algolia = SearchClient.create(
app_id=os.getenv('ALGOLIA_APP_ID'),
api_key=os.getenv('ALGOLIA_API_KEY')
)
employees_index = algolia.init_index(os.getenv('ALGOLIA_INDEX_NAME'))
# Setup Flask
STATIC_DIR = str(
os.path.abspath(os.path.join(
__file__,
'..',
os.getenv('STATIC_DIR')
))
)
app = Flask(
__name__,
static_folder=STATIC_DIR,
static_url_path="",
template_folder=STATIC_DIR
)
@app.route('/', methods=['GET'])
def scanner():
"""Display the index."""
return render_template('index.html')