Merge remote-tracking branch 'origin/master' into Astro

This commit is contained in:
斟酌 鵬兄 2016-05-30 12:33:09 +08:00
commit 5764257af7
4 changed files with 17 additions and 10 deletions

View File

@ -12,13 +12,14 @@ A working concept of Js/Css framework for web browsers
### Disclaimer ### Disclaimer
- This is a working concept. So it works on me. And may have a bunch of useless dependency. Use at your own risks! - 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 ### Documentation
- Will be added later - Will be added later
### Prerequisties ### Prerequisties
- python3
- virtualenv
#### For Service.WebAPI #### For Service.WebAPI
- pip install Flask - pip install Flask
- pip install Celery - pip install Celery
@ -27,11 +28,11 @@ A working concept of Js/Css framework for web browsers
### Before start, run ### Before start, run
``` ```
virtualenv env
./botan-rebuild ./botan-rebuild
``` ```
#### To start just run ( need to be root ) #### To start just run ( in virtualenv )
Don't worry, this will immediately drop root permission and switch to the user defined in settings.ini
``` ```
./botan-start ./botan-start
``` ```

View File

@ -4,7 +4,7 @@ from flask import Response
from flask import render_template from flask import render_template
from botanjs.service.jclassresv import BotanClassResolver as JCResv from botanjs.service.jclassresv import BotanClassResolver as JCResv
from botanjs.service.jwork import app as CeleryApp, JWork from botanjs.service.jwork import app as CeleryApp, JWork
from botanjs.config import DEBUG from botanjs.config import Config, DEBUG
import os 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.index )
self.app.add_url_rule( "/<path:mode>/<path:code>" , view_func = self.api_request ) self.app.add_url_rule( "/<path:mode>/<path:code>" , 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 ): def index( self ):
return "Hello, this is the BotanJS Service API.", 200 return "Hello, this is the BotanJS Service API.", 200
@ -52,6 +55,3 @@ class WebAPI:
return "Invalid request", 404 return "Invalid request", 404
if __name__ == "__main__":
WebAPI()

4
env/README.md vendored
View File

@ -1 +1,3 @@
virtualenv here ```
Please initialize your virtualenv here
```

View File

@ -1,3 +1,7 @@
[Service]
BindAddress = 0.0.0.0
Port = 5000
[Env] [Env]
Debug = False Debug = False