diff options
| author | 2018-02-09 12:19:55 +0000 | |
|---|---|---|
| committer | 2018-02-09 12:19:55 +0000 | |
| commit | b38a9f56e54eb21eec37f40075399961ba82906f (patch) | |
| tree | 3255dc43a11734726509a1ed79d7dfa1da02cb63 /pysite/views/main | |
| parent | Weird, PyCharm didn't commit all my changes last push (diff) | |
Move from straight app registration to Blueprints (#6)
Diffstat (limited to 'pysite/views/main')
| -rw-r--r-- | pysite/views/main/__init__.py | 1 | ||||
| -rw-r--r-- | pysite/views/main/error_handlers/__init__.py | 1 | ||||
| -rw-r--r-- | pysite/views/main/error_handlers/http_404.py | 12 | ||||
| -rw-r--r-- | pysite/views/main/index.py | 10 | ||||
| -rw-r--r-- | pysite/views/main/invite.py | 12 |
5 files changed, 36 insertions, 0 deletions
diff --git a/pysite/views/main/__init__.py b/pysite/views/main/__init__.py new file mode 100644 index 00000000..9bad5790 --- /dev/null +++ b/pysite/views/main/__init__.py @@ -0,0 +1 @@ +# coding=utf-8 diff --git a/pysite/views/main/error_handlers/__init__.py b/pysite/views/main/error_handlers/__init__.py new file mode 100644 index 00000000..9bad5790 --- /dev/null +++ b/pysite/views/main/error_handlers/__init__.py @@ -0,0 +1 @@ +# coding=utf-8 diff --git a/pysite/views/main/error_handlers/http_404.py b/pysite/views/main/error_handlers/http_404.py new file mode 100644 index 00000000..1d557d9b --- /dev/null +++ b/pysite/views/main/error_handlers/http_404.py @@ -0,0 +1,12 @@ +# coding=utf-8 +from werkzeug.exceptions import NotFound + +from pysite.base_route import ErrorView + + +class Error404View(ErrorView): + name = "error_404" + error_code = 404 + + def get(self, error: NotFound): + return "replace me with a template, 404 not found", 404 diff --git a/pysite/views/main/index.py b/pysite/views/main/index.py new file mode 100644 index 00000000..0c2d1578 --- /dev/null +++ b/pysite/views/main/index.py @@ -0,0 +1,10 @@ +# coding=utf-8 +from pysite.base_route import RouteView + + +class IndexView(RouteView): + path = "/" + name = "index" + + def get(self): + return self.render("index.html") diff --git a/pysite/views/main/invite.py b/pysite/views/main/invite.py new file mode 100644 index 00000000..9563a5e6 --- /dev/null +++ b/pysite/views/main/invite.py @@ -0,0 +1,12 @@ +# coding=utf-8 +from flask import redirect + +from pysite.base_route import RouteView + + +class InviteView(RouteView): + path = "/invite" + name = "invite" + + def get(self): + return redirect("http://invite.pythondiscord.com/") |