From 8644a1b68e88cf95757300be8fb3a56b950d1b32 Mon Sep 17 00:00:00 2001 From: tgckpg Date: Sat, 28 May 2016 01:52:18 +0800 Subject: [PATCH 1/3] Update README.md --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 657b365..29c63d2 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,14 @@ A working concept of Js/Css framework for web browsers ### Disclaimer - This is a working concept. So it works on me. And may have a bunch of useless dependency. Use at your own risks! -- It requires Python 3! - ### Documentation - Will be added later ### Prerequisties +- python3 +- virtualenv + #### For Service.WebAPI - pip install Flask - pip install Celery @@ -27,11 +28,11 @@ A working concept of Js/Css framework for web browsers ### Before start, run ``` +virtualenv env ./botan-rebuild ``` -#### To start just run ( need to be root ) -Don't worry, this will immediately drop root permission and switch to the user defined in settings.ini +#### To start just run ( in virtualenv ) ``` ./botan-start ``` From 2a36a0c3e154532268d5fa75f9fe03e77572f0c4 Mon Sep 17 00:00:00 2001 From: tgckpg Date: Sat, 28 May 2016 01:53:21 +0800 Subject: [PATCH 2/3] Update README.md --- env/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/env/README.md b/env/README.md index 1834eef..0335257 100644 --- a/env/README.md +++ b/env/README.md @@ -1 +1,3 @@ -virtualenv here +``` +Please initialize your virtualenv here +``` From 3a333c18653bbf6244c5df42b2aca7eead59776c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Mon, 30 May 2016 12:29:30 +0800 Subject: [PATCH 3/3] Settings added bind address and port --- botanjs/service/webapi.py | 10 +++++----- settings.ini | 4 ++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/botanjs/service/webapi.py b/botanjs/service/webapi.py index 4626a0c..08b238d 100755 --- a/botanjs/service/webapi.py +++ b/botanjs/service/webapi.py @@ -4,7 +4,7 @@ from flask import Response from flask import render_template from botanjs.service.jclassresv import BotanClassResolver as JCResv from botanjs.service.jwork import app as CeleryApp, JWork -from botanjs.config import DEBUG +from botanjs.config import Config, DEBUG import os @@ -32,7 +32,10 @@ class WebAPI: self.app.add_url_rule( "/" , view_func = self.index ) self.app.add_url_rule( "//" , view_func = self.api_request ) - self.app.run( host = "0.0.0.0", debug = DEBUG ) + self.app.run( + host = Config[ "Service" ][ "BindAddress" ] + , port = int( Config[ "Service" ][ "Port" ] ) + , debug = DEBUG ) def index( self ): return "Hello, this is the BotanJS Service API.", 200 @@ -52,6 +55,3 @@ class WebAPI: return "Invalid request", 404 - -if __name__ == "__main__": - WebAPI() diff --git a/settings.ini b/settings.ini index 1568871..358d491 100644 --- a/settings.ini +++ b/settings.ini @@ -1,3 +1,7 @@ +[Service] +BindAddress = 0.0.0.0 +Port = 5000 + [Env] Debug = True