1 |
commit: eb0340055871dc67b6d96287f6ec869bda674d2f |
2 |
Author: Mart Raudsepp <leio <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Sep 6 03:50:47 2016 +0000 |
4 |
Commit: Mart Raudsepp <leio <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Sep 6 03:52:35 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/grumpy.git/commit/?id=eb034005 |
7 |
|
8 |
Initial start of new Project Grumpy code; Hello World! |
9 |
|
10 |
virtualenv -p python3 venv |
11 |
venv/bin/activate |
12 |
pip install -r requirements.txt |
13 |
./manage.py runserver --help |
14 |
./manage.py shell for a python shell with flask instance exported into "app" var |
15 |
./manage.py runserver |
16 |
|
17 |
.gitignore | 2 ++ |
18 |
backend/__init__.py | 7 +++++++ |
19 |
manage.py | 17 +++++++++++++++++ |
20 |
requirements.txt | 2 ++ |
21 |
4 files changed, 28 insertions(+) |
22 |
|
23 |
diff --git a/.gitignore b/.gitignore |
24 |
new file mode 100644 |
25 |
index 0000000..0d27464 |
26 |
--- /dev/null |
27 |
+++ b/.gitignore |
28 |
@@ -0,0 +1,2 @@ |
29 |
+__pycache__ |
30 |
+venv/ |
31 |
|
32 |
diff --git a/backend/__init__.py b/backend/__init__.py |
33 |
new file mode 100644 |
34 |
index 0000000..81ca7eb |
35 |
--- /dev/null |
36 |
+++ b/backend/__init__.py |
37 |
@@ -0,0 +1,7 @@ |
38 |
+from flask import Flask |
39 |
+ |
40 |
+app = Flask(__name__) |
41 |
+ |
42 |
+@×××.route("/") |
43 |
+def hello_world(): |
44 |
+ return "Hello World!" |
45 |
|
46 |
diff --git a/manage.py b/manage.py |
47 |
new file mode 100755 |
48 |
index 0000000..b28d93a |
49 |
--- /dev/null |
50 |
+++ b/manage.py |
51 |
@@ -0,0 +1,17 @@ |
52 |
+#!/usr/bin/env python |
53 |
+# -*- coding: utf-8 -*- |
54 |
+ |
55 |
+from flask_script import Manager, Shell |
56 |
+ |
57 |
+from backend import app |
58 |
+ |
59 |
+ |
60 |
+manager = Manager(app) |
61 |
+ |
62 |
+def shell_context(): |
63 |
+ return dict(app=manager.app) |
64 |
+ |
65 |
+manager.add_command('shell', Shell(make_context=shell_context)) |
66 |
+ |
67 |
+if __name__ == '__main__': |
68 |
+ manager.run() |
69 |
|
70 |
diff --git a/requirements.txt b/requirements.txt |
71 |
new file mode 100644 |
72 |
index 0000000..eaf59ef |
73 |
--- /dev/null |
74 |
+++ b/requirements.txt |
75 |
@@ -0,0 +1,2 @@ |
76 |
+Flask |
77 |
+Flask-Script #manage.py |