mirror of https://gitlab.com/ceda_ei/sky
Add server.py with base structure. Update .gitignore.
This commit is contained in:
parent
1f267591ab
commit
c3bd238bdc
|
@ -1,2 +1,3 @@
|
||||||
config.py
|
config.py
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
cache.sqlite
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
from flask import Flask
|
||||||
|
from mapbox import Geocoder
|
||||||
|
import sqlite3
|
||||||
|
import config
|
||||||
|
|
||||||
|
geocoder = Geocoder(access_token=config.mapbox_key)
|
||||||
|
app = Flask(__name__)
|
||||||
|
cache_db = sqlite3.connect("cache.sqlite")
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/')
|
||||||
|
def index():
|
||||||
|
text = ("To get the weather for a location, run curl "
|
||||||
|
"https://sky.webionite.com/location. \n"
|
||||||
|
"Source: https://gitlab.com/ceda_ei/sky\n")
|
||||||
|
return text
|
||||||
|
|
||||||
|
|
||||||
|
def main(location, geocoder, cache_db):
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
app.add_url_rule('/<location>', 'location', lambda location:
|
||||||
|
main(location, geocoder, cache_db))
|
Loading…
Reference in New Issue