From e22afee0f69af2d4e870344748faa86da3856f78 Mon Sep 17 00:00:00 2001 From: Gautam Jain Date: Tue, 18 Jul 2017 13:43:10 +0530 Subject: [PATCH 1/6] Adds git push template for python webapp2 with google_app_engine sdk --- .../.idea/libraries/Google_App_Engine_SDK.xml | 52 ++ python-webapp2/.idea/misc.xml | 14 + python-webapp2/.idea/modules.xml | 8 + python-webapp2/.idea/python-webapp2.iml | 24 + python-webapp2/.idea/workspace.xml | 483 ++++++++++++++++++ python-webapp2/Dockerfile | 15 + python-webapp2/app.yaml | 17 + python-webapp2/docker-config.yaml | 4 + python-webapp2/main.py | 27 + python-webapp2/requirements.txt | 1 + 10 files changed, 645 insertions(+) create mode 100644 python-webapp2/.idea/libraries/Google_App_Engine_SDK.xml create mode 100644 python-webapp2/.idea/misc.xml create mode 100644 python-webapp2/.idea/modules.xml create mode 100644 python-webapp2/.idea/python-webapp2.iml create mode 100644 python-webapp2/.idea/workspace.xml create mode 100644 python-webapp2/Dockerfile create mode 100644 python-webapp2/app.yaml create mode 100644 python-webapp2/docker-config.yaml create mode 100644 python-webapp2/main.py create mode 100644 python-webapp2/requirements.txt diff --git a/python-webapp2/.idea/libraries/Google_App_Engine_SDK.xml b/python-webapp2/.idea/libraries/Google_App_Engine_SDK.xml new file mode 100644 index 0000000..fdd2cca --- /dev/null +++ b/python-webapp2/.idea/libraries/Google_App_Engine_SDK.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/python-webapp2/.idea/misc.xml b/python-webapp2/.idea/misc.xml new file mode 100644 index 0000000..6599d81 --- /dev/null +++ b/python-webapp2/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/python-webapp2/.idea/modules.xml b/python-webapp2/.idea/modules.xml new file mode 100644 index 0000000..5fdcba0 --- /dev/null +++ b/python-webapp2/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/python-webapp2/.idea/python-webapp2.iml b/python-webapp2/.idea/python-webapp2.iml new file mode 100644 index 0000000..0a38c62 --- /dev/null +++ b/python-webapp2/.idea/python-webapp2.iml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/python-webapp2/.idea/workspace.xml b/python-webapp2/.idea/workspace.xml new file mode 100644 index 0000000..f2010cc --- /dev/null +++ b/python-webapp2/.idea/workspace.xml @@ -0,0 +1,483 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + DEFINITION_ORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1500364488278 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/python-webapp2/Dockerfile b/python-webapp2/Dockerfile new file mode 100644 index 0000000..1e4d935 --- /dev/null +++ b/python-webapp2/Dockerfile @@ -0,0 +1,15 @@ +FROM jin09/app_engine + +MAINTAINER Gautam Jain + +RUN mkdir /home/src/ + +COPY / /home/src/ + +# RUN ls -la /home/src/* + +RUN rm -f /home/src/Dockerfile + +RUN pip install -r /home/src/requirements.txt + +CMD ["python", "/home/google_appengine/dev_appserver.py", "/home/src/app.yaml", "--skip_sdk_update_check=yes", "--host", "0.0.0.0", "--port", "8080"] \ No newline at end of file diff --git a/python-webapp2/app.yaml b/python-webapp2/app.yaml new file mode 100644 index 0000000..c6a6373 --- /dev/null +++ b/python-webapp2/app.yaml @@ -0,0 +1,17 @@ +application: python-webapp2 +version: 1 +runtime: python27 +api_version: 1 +threadsafe: yes + +handlers: +- url: /favicon\.ico + static_files: favicon.ico + upload: favicon\.ico + +- url: .* + script: main.app + +libraries: +- name: webapp2 + version: "2.5.2" diff --git a/python-webapp2/docker-config.yaml b/python-webapp2/docker-config.yaml new file mode 100644 index 0000000..e1abc04 --- /dev/null +++ b/python-webapp2/docker-config.yaml @@ -0,0 +1,4 @@ +image: "python2.7-webapp2:0.1" +port: 8080 +volume_mounts: null +env_variables: [] \ No newline at end of file diff --git a/python-webapp2/main.py b/python-webapp2/main.py new file mode 100644 index 0000000..65942b7 --- /dev/null +++ b/python-webapp2/main.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# +# Copyright 2007 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import webapp2 + + +class MainHandler(webapp2.RequestHandler): + def get(self): + self.response.write('Hello world!') + + +app = webapp2.WSGIApplication([ + ('/', MainHandler) +], debug=True) diff --git a/python-webapp2/requirements.txt b/python-webapp2/requirements.txt new file mode 100644 index 0000000..eb528cd --- /dev/null +++ b/python-webapp2/requirements.txt @@ -0,0 +1 @@ +webapp2 From fbba253b7efd6a94618b8467a5274ceda018423f Mon Sep 17 00:00:00 2001 From: Gautam Jain Date: Tue, 18 Jul 2017 15:57:00 +0530 Subject: [PATCH 2/6] Adds .gitignore, Removes .idea --- python-webapp2/.gitignore | 1 + .../.idea/libraries/Google_App_Engine_SDK.xml | 52 -- python-webapp2/.idea/misc.xml | 14 - python-webapp2/.idea/modules.xml | 8 - python-webapp2/.idea/python-webapp2.iml | 24 - python-webapp2/.idea/workspace.xml | 483 ------------------ 6 files changed, 1 insertion(+), 581 deletions(-) create mode 100644 python-webapp2/.gitignore delete mode 100644 python-webapp2/.idea/libraries/Google_App_Engine_SDK.xml delete mode 100644 python-webapp2/.idea/misc.xml delete mode 100644 python-webapp2/.idea/modules.xml delete mode 100644 python-webapp2/.idea/python-webapp2.iml delete mode 100644 python-webapp2/.idea/workspace.xml diff --git a/python-webapp2/.gitignore b/python-webapp2/.gitignore new file mode 100644 index 0000000..0d20b64 --- /dev/null +++ b/python-webapp2/.gitignore @@ -0,0 +1 @@ +*.pyc diff --git a/python-webapp2/.idea/libraries/Google_App_Engine_SDK.xml b/python-webapp2/.idea/libraries/Google_App_Engine_SDK.xml deleted file mode 100644 index fdd2cca..0000000 --- a/python-webapp2/.idea/libraries/Google_App_Engine_SDK.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/python-webapp2/.idea/misc.xml b/python-webapp2/.idea/misc.xml deleted file mode 100644 index 6599d81..0000000 --- a/python-webapp2/.idea/misc.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/python-webapp2/.idea/modules.xml b/python-webapp2/.idea/modules.xml deleted file mode 100644 index 5fdcba0..0000000 --- a/python-webapp2/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/python-webapp2/.idea/python-webapp2.iml b/python-webapp2/.idea/python-webapp2.iml deleted file mode 100644 index 0a38c62..0000000 --- a/python-webapp2/.idea/python-webapp2.iml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/python-webapp2/.idea/workspace.xml b/python-webapp2/.idea/workspace.xml deleted file mode 100644 index f2010cc..0000000 --- a/python-webapp2/.idea/workspace.xml +++ /dev/null @@ -1,483 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - DEFINITION_ORDER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1500364488278 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 62bd68a95cd69abe8a1eb3adf60b4e4372e27452 Mon Sep 17 00:00:00 2001 From: Gautam Jain Date: Wed, 19 Jul 2017 17:57:02 +0530 Subject: [PATCH 3/6] Adds git push template for vanilla python webapp2 without App Engine SDK --- python_webapp2_vanilla/Dockerfile | 13 +++++++++++++ python_webapp2_vanilla/README.md | 5 +++++ python_webapp2_vanilla/docker-config.yaml | 4 ++++ python_webapp2_vanilla/main.py | 16 ++++++++++++++++ python_webapp2_vanilla/requirements.txt | 0 5 files changed, 38 insertions(+) create mode 100644 python_webapp2_vanilla/Dockerfile create mode 100644 python_webapp2_vanilla/README.md create mode 100644 python_webapp2_vanilla/docker-config.yaml create mode 100644 python_webapp2_vanilla/main.py create mode 100644 python_webapp2_vanilla/requirements.txt diff --git a/python_webapp2_vanilla/Dockerfile b/python_webapp2_vanilla/Dockerfile new file mode 100644 index 0000000..6efce51 --- /dev/null +++ b/python_webapp2_vanilla/Dockerfile @@ -0,0 +1,13 @@ +FROM jin09/webapp2 + +MAINTAINER Gautam Jain + +RUN mkdir /home/src/ + +COPY / /home/src/ + +RUN rm -f /home/src/Dockerfile + +RUN pip install -r /home/src/requirements.txt + +CMD ["python", "/home/src/main.py"] diff --git a/python_webapp2_vanilla/README.md b/python_webapp2_vanilla/README.md new file mode 100644 index 0000000..c271b63 --- /dev/null +++ b/python_webapp2_vanilla/README.md @@ -0,0 +1,5 @@ +# Webapp2 Without App Engine SDK + +## PORT + +Default Port for application is `8080`. diff --git a/python_webapp2_vanilla/docker-config.yaml b/python_webapp2_vanilla/docker-config.yaml new file mode 100644 index 0000000..a3580f0 --- /dev/null +++ b/python_webapp2_vanilla/docker-config.yaml @@ -0,0 +1,4 @@ +image: "python2.7-webapp2_vanilla:0.1" +port: 8080 +volume_mounts: null +env_variables: [] diff --git a/python_webapp2_vanilla/main.py b/python_webapp2_vanilla/main.py new file mode 100644 index 0000000..04faee5 --- /dev/null +++ b/python_webapp2_vanilla/main.py @@ -0,0 +1,16 @@ +import webapp2 + +class HelloWebapp2(webapp2.RequestHandler): + def get(self): + self.response.write('Hello, webapp2!') + +app = webapp2.WSGIApplication([ + ('/', HelloWebapp2), +], debug=True) + +def main(): + from paste import httpserver + httpserver.serve(app, host='0.0.0.0', port='8080') + +if __name__ == '__main__': + main() diff --git a/python_webapp2_vanilla/requirements.txt b/python_webapp2_vanilla/requirements.txt new file mode 100644 index 0000000..e69de29 From bc5b7b64cd153112584ca7b0be8a9734d410dad5 Mon Sep 17 00:00:00 2001 From: Gautam Jain Date: Wed, 19 Jul 2017 17:58:08 +0530 Subject: [PATCH 4/6] Adds README.md for webapp2 with app engine sdk tmeplate --- python-webapp2/README.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 python-webapp2/README.md diff --git a/python-webapp2/README.md b/python-webapp2/README.md new file mode 100644 index 0000000..e71d259 --- /dev/null +++ b/python-webapp2/README.md @@ -0,0 +1,7 @@ +# Webapp2 With App Engine SDK + +Developer can leverage the App Engine services as well eg. Datastore, Memcache etc. + +## PORT + +Default Port for application is `8080`. From 92881c371ae7289d0b994ca1b17bdf848081d3ca Mon Sep 17 00:00:00 2001 From: Gautam Jain Date: Wed, 19 Jul 2017 18:07:22 +0530 Subject: [PATCH 5/6] Adds .gitignore --- python_webapp2_vanilla/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 python_webapp2_vanilla/.gitignore diff --git a/python_webapp2_vanilla/.gitignore b/python_webapp2_vanilla/.gitignore new file mode 100644 index 0000000..0d20b64 --- /dev/null +++ b/python_webapp2_vanilla/.gitignore @@ -0,0 +1 @@ +*.pyc From 749c18dfd91edcaea31239c7f1d0387a833e51b9 Mon Sep 17 00:00:00 2001 From: Gautam Jain Date: Tue, 22 Aug 2017 15:27:45 +0530 Subject: [PATCH 6/6] Moves project files to separate app directory, replaces underscores with hyphens in folder name --- .../.gitignore | 0 .../Dockerfile | 4 +--- .../README.md | 0 .../app}/docker-config.yaml | 0 .../app}/main.py | 0 .../app}/requirements.txt | 0 python-webapp2/Dockerfile | 6 +++--- python-webapp2/{ => app}/app.yaml | 0 python-webapp2/{ => app}/docker-config.yaml | 0 python-webapp2/{ => app}/main.py | 0 python-webapp2/{ => app}/requirements.txt | 0 11 files changed, 4 insertions(+), 6 deletions(-) rename {python_webapp2_vanilla => python-webapp2-vanilla}/.gitignore (100%) rename {python_webapp2_vanilla => python-webapp2-vanilla}/Dockerfile (77%) rename {python_webapp2_vanilla => python-webapp2-vanilla}/README.md (100%) rename {python_webapp2_vanilla => python-webapp2-vanilla/app}/docker-config.yaml (100%) rename {python_webapp2_vanilla => python-webapp2-vanilla/app}/main.py (100%) rename {python_webapp2_vanilla => python-webapp2-vanilla/app}/requirements.txt (100%) rename python-webapp2/{ => app}/app.yaml (100%) rename python-webapp2/{ => app}/docker-config.yaml (100%) rename python-webapp2/{ => app}/main.py (100%) rename python-webapp2/{ => app}/requirements.txt (100%) diff --git a/python_webapp2_vanilla/.gitignore b/python-webapp2-vanilla/.gitignore similarity index 100% rename from python_webapp2_vanilla/.gitignore rename to python-webapp2-vanilla/.gitignore diff --git a/python_webapp2_vanilla/Dockerfile b/python-webapp2-vanilla/Dockerfile similarity index 77% rename from python_webapp2_vanilla/Dockerfile rename to python-webapp2-vanilla/Dockerfile index 6efce51..26ad9c6 100644 --- a/python_webapp2_vanilla/Dockerfile +++ b/python-webapp2-vanilla/Dockerfile @@ -4,9 +4,7 @@ MAINTAINER Gautam Jain RUN mkdir /home/src/ -COPY / /home/src/ - -RUN rm -f /home/src/Dockerfile +COPY /app /home/src/ RUN pip install -r /home/src/requirements.txt diff --git a/python_webapp2_vanilla/README.md b/python-webapp2-vanilla/README.md similarity index 100% rename from python_webapp2_vanilla/README.md rename to python-webapp2-vanilla/README.md diff --git a/python_webapp2_vanilla/docker-config.yaml b/python-webapp2-vanilla/app/docker-config.yaml similarity index 100% rename from python_webapp2_vanilla/docker-config.yaml rename to python-webapp2-vanilla/app/docker-config.yaml diff --git a/python_webapp2_vanilla/main.py b/python-webapp2-vanilla/app/main.py similarity index 100% rename from python_webapp2_vanilla/main.py rename to python-webapp2-vanilla/app/main.py diff --git a/python_webapp2_vanilla/requirements.txt b/python-webapp2-vanilla/app/requirements.txt similarity index 100% rename from python_webapp2_vanilla/requirements.txt rename to python-webapp2-vanilla/app/requirements.txt diff --git a/python-webapp2/Dockerfile b/python-webapp2/Dockerfile index 1e4d935..55d1c6f 100644 --- a/python-webapp2/Dockerfile +++ b/python-webapp2/Dockerfile @@ -4,12 +4,12 @@ MAINTAINER Gautam Jain RUN mkdir /home/src/ -COPY / /home/src/ +COPY /app /home/src/ # RUN ls -la /home/src/* -RUN rm -f /home/src/Dockerfile +# RUN rm -f /home/src/Dockerfile RUN pip install -r /home/src/requirements.txt -CMD ["python", "/home/google_appengine/dev_appserver.py", "/home/src/app.yaml", "--skip_sdk_update_check=yes", "--host", "0.0.0.0", "--port", "8080"] \ No newline at end of file +CMD ["python", "/home/google_appengine/dev_appserver.py", "/home/src/app.yaml", "--skip_sdk_update_check=yes", "--host", "0.0.0.0", "--port", "8080"] diff --git a/python-webapp2/app.yaml b/python-webapp2/app/app.yaml similarity index 100% rename from python-webapp2/app.yaml rename to python-webapp2/app/app.yaml diff --git a/python-webapp2/docker-config.yaml b/python-webapp2/app/docker-config.yaml similarity index 100% rename from python-webapp2/docker-config.yaml rename to python-webapp2/app/docker-config.yaml diff --git a/python-webapp2/main.py b/python-webapp2/app/main.py similarity index 100% rename from python-webapp2/main.py rename to python-webapp2/app/main.py diff --git a/python-webapp2/requirements.txt b/python-webapp2/app/requirements.txt similarity index 100% rename from python-webapp2/requirements.txt rename to python-webapp2/app/requirements.txt