Merge branch 'bottle'
This commit is contained in:
		
						commit
						2e3c069410
					
				
							
								
								
									
										0
									
								
								.beaker/data/.noremove
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								.beaker/data/.noremove
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										6
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -1 +1,7 @@
 | 
				
			|||||||
**/__pycache__
 | 
					**/__pycache__
 | 
				
			||||||
 | 
					*.pyc
 | 
				
			||||||
 | 
					venv/
 | 
				
			||||||
 | 
					env/
 | 
				
			||||||
 | 
					.beaker/data/*
 | 
				
			||||||
 | 
					!.beaker/data/.noremove
 | 
				
			||||||
 | 
					nohup.out
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										18
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								README.md
									
									
									
									
									
								
							@ -22,9 +22,26 @@ along with this program.  If not, see https://www.gnu.org/licenses/.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
## Requirement & Installation
 | 
					## Requirement & Installation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Clone the repository
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Clone the repository with `--recursive` when cloning the repo.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    git clone https://gitea.ditaajipratama.net/aji/costapy.git --recursive
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Note that if you forgot the `--recursive` flag you can do:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    git submodule update --init
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Note that when submodules have other submodules you need recursive option.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    git submodule update --init --recursive
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Dependencies
 | 
				
			||||||
 | 
					
 | 
				
			||||||
You need this libraries to use CostaPy:
 | 
					You need this libraries to use CostaPy:
 | 
				
			||||||
- bottle
 | 
					- bottle
 | 
				
			||||||
- gunicorn
 | 
					- gunicorn
 | 
				
			||||||
 | 
					- beaker
 | 
				
			||||||
- mako
 | 
					- mako
 | 
				
			||||||
 | 
					
 | 
				
			||||||
You can install it with run this command
 | 
					You can install it with run this command
 | 
				
			||||||
@ -37,6 +54,7 @@ Here is the completed command
 | 
				
			|||||||
    pip install --upgrade pip
 | 
					    pip install --upgrade pip
 | 
				
			||||||
    pip install bottle
 | 
					    pip install bottle
 | 
				
			||||||
    pip install gunicorn
 | 
					    pip install gunicorn
 | 
				
			||||||
 | 
					    pip install beaker
 | 
				
			||||||
    pip install mako
 | 
					    pip install mako
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Usage
 | 
					## Usage
 | 
				
			||||||
 | 
				
			|||||||
@ -3,5 +3,6 @@ db_main = {
 | 
				
			|||||||
    'user'       : 'root',
 | 
					    'user'       : 'root',
 | 
				
			||||||
    'password'   : '',
 | 
					    'password'   : '',
 | 
				
			||||||
    'database'   : 'your_db',
 | 
					    'database'   : 'your_db',
 | 
				
			||||||
 | 
					    'port'       : 3306,
 | 
				
			||||||
    'autocommit' : True,
 | 
					    'autocommit' : True,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -4,8 +4,14 @@ reloader    = False
 | 
				
			|||||||
debug       = False
 | 
					debug       = False
 | 
				
			||||||
server      = 'gunicorn' # default = 'wsgiref'
 | 
					server      = 'gunicorn' # default = 'wsgiref'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					session_opts = {
 | 
				
			||||||
 | 
					    'session.type': 'file',
 | 
				
			||||||
 | 
					    'session.cookie_expires': 5*60, # Session expiration in seconds: minutes*seconds
 | 
				
			||||||
 | 
					    'session.data_dir': './.beaker/data',
 | 
				
			||||||
 | 
					    'session.auto': True
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# cors
 | 
					# cors
 | 
				
			||||||
# session
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# error page 403
 | 
					# error page 403
 | 
				
			||||||
# error page 404
 | 
					# error page 404
 | 
				
			||||||
 | 
				
			|||||||
@ -1,9 +1,7 @@
 | 
				
			|||||||
from    bottle      import Bottle, get, static_file
 | 
					from    bottle      import Bottle, static_file
 | 
				
			||||||
from    config      import directory
 | 
					from    config      import directory
 | 
				
			||||||
 | 
					
 | 
				
			||||||
app = Bottle()
 | 
					app = Bottle()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
for items in directory.static:
 | 
					for item in directory.static:
 | 
				
			||||||
    @app.get(items['route'])
 | 
					    app.route(item['route'], "GET", lambda filepath, root=item['root']: static_file(filepath, root=root) )
 | 
				
			||||||
    def static_items(filepath):
 | 
					 | 
				
			||||||
        return static_file(filepath, root=items['root'])
 | 
					 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										5
									
								
								costa.py
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								costa.py
									
									
									
									
									
								
							@ -6,7 +6,8 @@
 | 
				
			|||||||
# You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
 | 
					# You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import  sys
 | 
					import  sys
 | 
				
			||||||
from    bottle      import Bottle, run
 | 
					from    bottle                  import Bottle, run
 | 
				
			||||||
 | 
					from    beaker.middleware       import SessionMiddleware
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import  handler
 | 
					import  handler
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -18,6 +19,8 @@ app = Bottle()
 | 
				
			|||||||
app.merge(handler.app)
 | 
					app.merge(handler.app)
 | 
				
			||||||
app.merge(staticdir.app)
 | 
					app.merge(staticdir.app)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					app = SessionMiddleware(app, server.session_opts)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
run(app,
 | 
					run(app,
 | 
				
			||||||
    host = server.host,
 | 
					    host = server.host,
 | 
				
			||||||
    port = server.port,
 | 
					    port = server.port,
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,6 @@
 | 
				
			|||||||
sudo apt-get install -y python3-pip
 | 
					sudo apt-get install -y python3-pip
 | 
				
			||||||
pip install --upgrade pip
 | 
					pip install --upgrade pip
 | 
				
			||||||
pip install bottle
 | 
					pip install bottle # Micro Framework
 | 
				
			||||||
pip install gunicorn
 | 
					pip install gunicorn # WSGI Server Backend
 | 
				
			||||||
pip install mako
 | 
					pip install beaker # Session & caching library
 | 
				
			||||||
 | 
					pip install mako # Template library
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user