From dc5d42bedc0b5dffb3948186eac7aef1ef49eb97 Mon Sep 17 00:00:00 2001 From: Simon Milvert Date: Tue, 25 Apr 2017 13:22:24 +0200 Subject: [PATCH] Added layout --- ferry/__init__.py | 0 ferry/app.py | 27 ++++++++++++ ferry/templates/base.html | 43 ++++++++++++++++++ ferry/templates/index.html | 58 +++++++++++++++++++++++++ app.py => ferry/views.py | 17 +++----- requirements.txt | 89 +++++++++++++++++++++++++++++++++++++- run.py | 10 +++++ 7 files changed, 231 insertions(+), 13 deletions(-) create mode 100644 ferry/__init__.py create mode 100644 ferry/app.py create mode 100644 ferry/templates/base.html create mode 100644 ferry/templates/index.html rename app.py => ferry/views.py (83%) create mode 100644 run.py diff --git a/ferry/__init__.py b/ferry/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/ferry/app.py b/ferry/app.py new file mode 100644 index 0000000..ee652a6 --- /dev/null +++ b/ferry/app.py @@ -0,0 +1,27 @@ +from flask import Flask, url_for +import logging + +def make_app(): + app = Flask(__name__) + app.config['DEBUG'] = True + app.config['SECRET_KEY'] = 'SECRET_KEY' + # Function to easily find your assets + # In your template use + app.jinja_env.globals['static'] = ( + lambda filename: url_for('static', filename = filename) + ) + app.config['LIVERELOAD'] = True + + return app + +app = make_app() + +log = logging.getLogger() + +def configure(config_file): + config = load_config(config_file) + app.api_config = config + + + +import ferry.views diff --git a/ferry/templates/base.html b/ferry/templates/base.html new file mode 100644 index 0000000..4976947 --- /dev/null +++ b/ferry/templates/base.html @@ -0,0 +1,43 @@ + + + + + + + + Gräsö färja + + + + + + + + + + + + + + + + + + + + {% block body %}{% endblock %} + + + + + + + + + + + + + + + diff --git a/ferry/templates/index.html b/ferry/templates/index.html new file mode 100644 index 0000000..3959837 --- /dev/null +++ b/ferry/templates/index.html @@ -0,0 +1,58 @@ +{% extends 'base.html' %} + +{% block body %} + + + +
+
+ + +
+
+
+

flash_on

+
Speeds up development
+ +

We did most of the heavy lifting for you to provide a default stylings that incorporate our custom components. Additionally, we refined animations and transitions to provide a smoother experience for developers.

+
+
+ +
+
+

group

+
User Experience Focused
+ +

By utilizing elements and principles of Material Design, we were able to create a framework that incorporates components and animations that provide more feedback to users. Additionally, a single underlying responsive system across all platforms allow for a more unified user experience.

+
+
+ +
+
+

settings

+
Easy to work with
+ +

We have provided detailed documentation as well as specific code examples to help new users get started. We are also always open to feedback and can answer any questions a user may have about Materialize.

+
+
+
+ +
+

+ +
+ + + + +{% endblock %} diff --git a/app.py b/ferry/views.py similarity index 83% rename from app.py rename to ferry/views.py index 8e66b94..0024cf9 100644 --- a/app.py +++ b/ferry/views.py @@ -1,12 +1,11 @@ -from flask import Flask -import requests -app = Flask(__name__) +from ferry.app import app +from flask import render_template + @app.route('/') -def hello(): - r = request() - return r.text - +@app.route('/index') +def index(): + return render_template('index.html') def request(): url = 'http://api.trafikinfo.trafikverket.se/beta/data.json' @@ -35,7 +34,3 @@ def request(): """ r = requests.post(url, data=xml_data, headers=headers) return r - -if __name__ == '__main__': - app.run(debug=True) - diff --git a/requirements.txt b/requirements.txt index 0952365..01a0f03 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,93 @@ +apsw==3.8.11.1.post1 +attrs==16.0.0 +BeautifulSoup==3.2.1 +beautifulsoup4==4.5.1 +blinker==1.3 +boto==2.40.0 +cffi==1.7.0 +characteristic==14.3.0 +chardet==2.3.0 +CherryPy==3.5.0 click==6.7 +configobj==5.0.6 +cryptography==1.5 +cssselect==0.9.2 +cssutils==1.0 +debtags==2.0 +decorator==4.0.6 +defer==1.0.6 +dirspec==13.10 +dnspython==1.14.0 +dulwich==0.14.1 +duplicity==0.7.6 +enum34==1.1.6 +ExifRead==2.1.2 +fastimport==0.9.6 +feedparser==5.1.3 Flask==0.12.1 +html5lib==0.999 +httplib2==0.9.1 +idna==2.1 +ipaddress==1.0.16 +ipython==2.4.1 itsdangerous==0.24 Jinja2==2.9.6 +lockfile==0.12.2 +lxml==3.6.4 +Markdown==2.6.7 MarkupSafe==1.0 -requests==2.13.0 +mechanize==0.2.5 +meld==3.16.3 +mutagen==1.34 +ndg-httpsclient==0.4.2 +netifaces==0.10.4 +oauthlib==1.1.2 +oneconf==0.3.9 +PAM==0.4.2 +pbr==1.8.1 +pexpect==4.2.0 +Pillow==3.3.1 +piston-mini-client==0.7.5 +Pivy==0.5.0 +ply==3.7 +ptyprocess==0.5.1 +pyasn1==0.1.9 +pyasn1-modules==0.0.7 +pycparser==2.14 +pycrypto==2.6.1 +pycups==1.9.73 +Pygments==2.1.3 +pygobject==3.22.0 +PyJWT==1.4.1 +pyOpenSSL==16.1.0 +pyparsing==2.1.8 +pyserial==3.1.1 +python-apt==1.1.0b5 +python-cloudfiles==1.7.10 +python-dateutil==2.4.2 +python-debian==0.1.29 +pyxdg==0.25 +PyYAML==3.11 +rabbitvcs==0.16.0 +repoze.lru==0.6 +requests==2.10.0 +Routes==2.2 +service-identity==16.0.0 +simplegeneric==0.8.1 +simplejson==3.8.2 +six==1.10.0 +software-center-aptd-plugins==0.0.0 +stevedore==1.10.0 +svtplay-dl==0.30.2016.1.10 +Twisted==16.4.1 +urllib3==1.15.1 +uTidylib==0.3 +vboxapi==1.0 +virtualenv==13.1.2 +virtualenv-clone==0.2.6 +virtualenvwrapper==4.7.1 +WebOb==1.6.1 Werkzeug==0.12.1 -wheel==0.24.0 +wxPython==3.0.2.0 +wxPython-common==3.0.2.0 +zope.interface==4.2.0 diff --git a/run.py b/run.py new file mode 100644 index 0000000..3b15b05 --- /dev/null +++ b/run.py @@ -0,0 +1,10 @@ + +from ferry.app import app +from livereload import Server + +server = Server(app.wsgi_app) + +if __name__ == '__main__': + app.debug = True + server.serve(host="0.0.0.0", port=5500) +