Merge pull request #102 from jokajak/master
Add example files for running clipperz with uwsgi and nginx
This commit is contained in:
commit
2f565165b6
@ -1,10 +1,11 @@
|
||||
"""Clipperz views."""
|
||||
from flask import session, request, g
|
||||
from flask import session, request, g, send_from_directory
|
||||
from clipperz import app, db, lm
|
||||
from .models import User
|
||||
from .api import * # NOQA
|
||||
from .exceptions import InvalidUsage
|
||||
from flask.ext.login import login_required
|
||||
from os.path import dirname
|
||||
|
||||
|
||||
@lm.user_loader
|
||||
@ -113,19 +114,25 @@ def dump(frontend_version):
|
||||
@app.route('/beta/<path:path>')
|
||||
def beta(path):
|
||||
"""Fallback for serving beta version."""
|
||||
return send_from_directory('beta', path)
|
||||
here = dirname(__file__)
|
||||
file_path = "{0}/../beta/".format(here)
|
||||
return send_from_directory(file_path, path)
|
||||
|
||||
|
||||
@app.route('/gamma/<path:path>')
|
||||
def gamma(path):
|
||||
"""Fallback for serving gamma version."""
|
||||
return send_from_directory('gamma', path)
|
||||
here = dirname(__file__)
|
||||
file_path = "{0}/../gamma/".format(here)
|
||||
return send_from_directory(file_path, path)
|
||||
|
||||
|
||||
@app.route('/delta/<path:path>')
|
||||
def delta(path):
|
||||
"""Fallback for serving delta version."""
|
||||
return send_from_directory('delta', path)
|
||||
here = dirname(__file__)
|
||||
file_path = "{0}/../delta/".format(here)
|
||||
return send_from_directory(file_path, path)
|
||||
|
||||
|
||||
@app.route('/pm', methods=['GET', 'OPTIONS', 'POST'])
|
||||
|
11
backend/flask/src/nginx.conf.example
Normal file
11
backend/flask/src/nginx.conf.example
Normal file
@ -0,0 +1,11 @@
|
||||
location /pm {
|
||||
auth_basic "Restricted";
|
||||
auth_basic_user_file /etc/nginx/.htpasswd;
|
||||
try_files $uri $uri/ @pm;
|
||||
}
|
||||
location @pm {
|
||||
include uwsgi_params;
|
||||
uwsgi_param SCRIPT_NAME /pm;
|
||||
uwsgi_modifier1 30;
|
||||
uwsgi_pass unix:/run/uwsgi/pm.sock;
|
||||
}
|
10
backend/flask/src/run.py
Normal file
10
backend/flask/src/run.py
Normal file
@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
from clipperz import app, db
|
||||
|
||||
|
||||
def main():
|
||||
db.create_all()
|
||||
app.run(debug=True)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
28
backend/flask/src/uwsg-emperor.ini.example
Normal file
28
backend/flask/src/uwsg-emperor.ini.example
Normal file
@ -0,0 +1,28 @@
|
||||
[uwsgi]
|
||||
plugin = python
|
||||
socket = /run/uwsgi/%n.sock
|
||||
chmod-socket = 660
|
||||
master = true
|
||||
processes = 1
|
||||
uid = clipperz
|
||||
gid = clipperz
|
||||
umask = 027
|
||||
procname-master = uwsgi pm
|
||||
|
||||
vacuum = true
|
||||
|
||||
die-on-term = true
|
||||
|
||||
base = /home/clipperz/password-manager/target/flask/
|
||||
module = clipperz
|
||||
callable = app
|
||||
venv = /home/clipperz/password-manager/target/flask/
|
||||
|
||||
#the variable that holds a flask application inside the module imported at line #6
|
||||
callable = app
|
||||
|
||||
#location of log files
|
||||
logto = /var/log/uwsgi/%n.log
|
||||
|
||||
env = PYTHON_EGG_CACHE=/var/tmp/clipperz
|
||||
env = DATABASE_URL = 'mysql://clipperz:clipperz@localhost/clipperz'
|
Loading…
Reference in New Issue
Block a user