Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions python-webapp2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pyc
15 changes: 15 additions & 0 deletions python-webapp2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM jin09/app_engine

MAINTAINER Gautam Jain <[email protected]>

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"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can create an app directory instead of putting the source code in /home. That way it will be cleaner.

7 changes: 7 additions & 0 deletions python-webapp2/README.md
Original file line number Diff line number Diff line change
@@ -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`.
17 changes: 17 additions & 0 deletions python-webapp2/app.yaml
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 4 additions & 0 deletions python-webapp2/docker-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
image: "python2.7-webapp2:0.1"
port: 8080
volume_mounts: null
env_variables: []
27 changes: 27 additions & 0 deletions python-webapp2/main.py
Original file line number Diff line number Diff line change
@@ -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)
1 change: 1 addition & 0 deletions python-webapp2/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
webapp2
1 change: 1 addition & 0 deletions python_webapp2_vanilla/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pyc
13 changes: 13 additions & 0 deletions python_webapp2_vanilla/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM jin09/webapp2

MAINTAINER Gautam Jain <[email protected]>

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"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with having an app directory instead of putting it in /home.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, in the directory name of vanilla webapp2 use hyphens instead of underscore (as every other folder is hyphenated). So python-webapp2-vanilla instead of python_webapp2_vanilla.

5 changes: 5 additions & 0 deletions python_webapp2_vanilla/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Webapp2 Without App Engine SDK

## PORT

Default Port for application is `8080`.
4 changes: 4 additions & 0 deletions python_webapp2_vanilla/docker-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
image: "python2.7-webapp2_vanilla:0.1"
port: 8080
volume_mounts: null
env_variables: []
16 changes: 16 additions & 0 deletions python_webapp2_vanilla/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import webapp2

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The requirements.txt is empty. Are you sure it doesn't need webapp2?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it doesn't need webapp2 since it is already installed in the custom base Image that I have built for this (jin09/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()
Empty file.