Implement session with beaker
This commit is contained in:
parent
3a7027bd3e
commit
8760144735
0
.beaker/data/.noremove
Normal file
0
.beaker/data/.noremove
Normal file
5
.gitignore
vendored
5
.gitignore
vendored
@ -1 +1,6 @@
|
||||
**/__pycache__
|
||||
*.pyc
|
||||
venv/
|
||||
env/
|
||||
.beaker/data/*
|
||||
!.beaker/data/.noremove
|
||||
|
@ -4,8 +4,14 @@ reloader = False
|
||||
debug = False
|
||||
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
|
||||
# session
|
||||
|
||||
# error page 403
|
||||
# error page 404
|
||||
|
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/.
|
||||
|
||||
import sys
|
||||
from bottle import Bottle, run
|
||||
from bottle import Bottle, run
|
||||
from beaker.middleware import SessionMiddleware
|
||||
|
||||
import handler
|
||||
|
||||
@ -18,6 +19,8 @@ app = Bottle()
|
||||
app.merge(handler.app)
|
||||
app.merge(staticdir.app)
|
||||
|
||||
app = SessionMiddleware(app, server.session_opts)
|
||||
|
||||
run(app,
|
||||
host = server.host,
|
||||
port = server.port,
|
||||
|
@ -1,5 +1,6 @@
|
||||
sudo apt-get install -y python3-pip
|
||||
pip install --upgrade pip
|
||||
pip install bottle
|
||||
pip install gunicorn
|
||||
pip install mako
|
||||
pip install bottle # Micro Framework
|
||||
pip install gunicorn # WSGI Server Backend
|
||||
pip install beaker # Session & caching library
|
||||
pip install mako # Template library
|
||||
|
Loading…
Reference in New Issue
Block a user