瀏覽代碼

moved wheezy.web bash_profile to install and setup files

Keith Newman 10 年之前
父節點
當前提交
114bc9ce81

+ 4 - 1
frameworks/Python/wheezyweb/app.py

@@ -66,7 +66,9 @@ class World(Base):
 
 class JsonHandler(BaseHandler):
     def get(self):
-        return self.json_response({"message": "Hello, world!"})
+        response = self.json_response({"message": "Hello, World!"})
+        response.headers = [("Content-Type", "application/json; charset=UTF-8")]
+        return response
 
 class DbHandler(BaseHandler):
     def get(self):
@@ -123,6 +125,7 @@ class FortuneHandler(BaseHandler):
 
 def plaintext(request):
     response = HTTPResponse()
+    response.headers = [("Content-Type", "text/plain; charset=UTF-8")]
     response.write("Hello, world!")
     return response
 

+ 0 - 9
frameworks/Python/wheezyweb/bash_profile.sh

@@ -1,9 +0,0 @@
-export PY2_ROOT=$IROOT/py2
-export PY2=$PY2_ROOT/bin/python
-export PY2_PIP=$PY2_ROOT/bin/pip
-export PY2_GUNICORN=$PY2_ROOT/bin/gunicorn
-
-export PY3_ROOT=$IROOT/py3
-export PY3=$PY3_ROOT/bin/python3
-export PY3_PIP=$PY3_ROOT/bin/pip3
-export PY3_GUNICORN=$PY3_ROOT/bin/gunicorn

+ 6 - 0
frameworks/Python/wheezyweb/install.sh

@@ -5,6 +5,12 @@ export PIP_DOWNLOAD_CACHE=$IROOT/.pip_cache
 
 fw_depends python2 python3 
 
+export PY2_ROOT=$IROOT/py2
+export PY2_PIP=$PY2_ROOT/bin/pip
+
+export PY3_ROOT=$IROOT/py3
+export PY3_PIP=$PY3_ROOT/bin/pip3
+
 $PY2_PIP install --install-option="--prefix=${PY2_ROOT}" -r $TROOT/requirements.txt
 
 $PY3_PIP install --install-option="--prefix=${PY3_ROOT}" -r $TROOT/requirements.txt

+ 3 - 0
frameworks/Python/wheezyweb/setup.sh

@@ -1,3 +1,6 @@
 #!/bin/bash
 
+export PY2_ROOT=$IROOT/py2
+export PY2_GUNICORN=$PY2_ROOT/bin/gunicorn
+
 $PY2_GUNICORN app:app -c gunicorn_conf.py &

+ 3 - 0
frameworks/Python/wheezyweb/setup_py3.sh

@@ -1,3 +1,6 @@
 #!/bin/bash
 
+export PY3_ROOT=$IROOT/py3
+export PY3_GUNICORN=$PY3_ROOT/bin/gunicorn
+
 $PY3_GUNICORN app:app -c gunicorn_conf.py &