parent
e29ead1fb0
commit
4c8b6f79de
2 changed files with 34 additions and 31 deletions
|
@ -12,9 +12,10 @@ You need sudo grants on this server, and it must be connected to Internet.
|
|||
*Note: uMap also works with python 2.7 and 3.4, so adapt the package names if you work with another version.*
|
||||
|
||||
|
||||
## Create a deployment directory:
|
||||
## Create deployment directories:
|
||||
|
||||
sudo mkdir -p /srv/umap
|
||||
sudo mkdir -p /etc/umap
|
||||
|
||||
*You can change this path, but then remember to adapt the other steps accordingly.*
|
||||
|
||||
|
@ -27,6 +28,11 @@ You need sudo grants on this server, and it must be connected to Internet.
|
|||
on the various commands and configuration files if you go with your own.*
|
||||
|
||||
|
||||
## Give umap user access to the config folder
|
||||
|
||||
sudo chown umap:users /etc/umap
|
||||
|
||||
|
||||
## Create a postgresql user
|
||||
|
||||
sudo -u postgres createuser umap
|
||||
|
@ -65,15 +71,8 @@ you will need to run again this last line.*
|
|||
|
||||
## Create a local configuration file
|
||||
|
||||
wget https://raw.githubusercontent.com/umap-project/umap/master/umap/settings/local.py.sample -O /srv/umap/local.py
|
||||
wget https://raw.githubusercontent.com/umap-project/umap/master/umap/settings/local.py.sample -O /etc/umap/umap.conf
|
||||
|
||||
Now we need to inform umap about it.
|
||||
We'll create an environment variable for that:
|
||||
|
||||
export UMAP_SETTINGS=/srv/umap/local.py
|
||||
|
||||
*Note: this variable will not be persistent if you quit your current terminal session, so
|
||||
remember to rerun this command if you open a new terminal window.*
|
||||
|
||||
## Create the tables
|
||||
|
||||
|
@ -147,8 +146,6 @@ chdir = /srv/umap/
|
|||
module = umap.wsgi
|
||||
# the virtualenv (full path)
|
||||
home = /srv/umap/venv
|
||||
# the local settings path
|
||||
env = UMAP_SETTINGS=/srv/umap/local.py
|
||||
|
||||
# process-related settings
|
||||
# master
|
||||
|
|
|
@ -9,24 +9,30 @@ from .base import * # NOQA, default values
|
|||
# Allow to override setting from any file, may be out of the PYTHONPATH,
|
||||
# to make it easier for non python people.
|
||||
path = os.environ.get('UMAP_SETTINGS')
|
||||
if path:
|
||||
d = imp.new_module('config')
|
||||
d.__file__ = path
|
||||
try:
|
||||
with open(path) as config_file:
|
||||
exec(compile(config_file.read(), path, 'exec'), d.__dict__)
|
||||
except IOError as e:
|
||||
msg = 'Unable to import {} from UMAP_SETTINGS'.format(path)
|
||||
print(colorize(msg, fg='red'))
|
||||
sys.exit(e)
|
||||
else:
|
||||
print('Loaded local config from', path)
|
||||
for key in dir(d):
|
||||
if key.isupper():
|
||||
globals()[key] = getattr(d, key)
|
||||
else:
|
||||
if not path:
|
||||
# Retrocompat
|
||||
try:
|
||||
from .local import * # NOQA
|
||||
except ImportError:
|
||||
pass
|
||||
path = os.path.join('/etc', 'umap', 'umap.conf')
|
||||
if not os.path.exists(path):
|
||||
# Retrocompat
|
||||
path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
||||
'local.py')
|
||||
if not os.path.exists(path):
|
||||
msg = ('You must configure UMAP_SETTINGS or define '
|
||||
'/etc/umap/umap.conf')
|
||||
print(colorize(msg, fg='red'))
|
||||
sys.exit(1)
|
||||
|
||||
d = imp.new_module('config')
|
||||
d.__file__ = path
|
||||
try:
|
||||
with open(path) as config_file:
|
||||
exec(compile(config_file.read(), path, 'exec'), d.__dict__)
|
||||
except IOError as e:
|
||||
msg = 'Unable to import {} from UMAP_SETTINGS'.format(path)
|
||||
print(colorize(msg, fg='red'))
|
||||
sys.exit(e)
|
||||
else:
|
||||
print('Loaded local config from', path)
|
||||
for key in dir(d):
|
||||
if key.isupper():
|
||||
globals()[key] = getattr(d, key)
|
||||
|
|
Loading…
Reference in a new issue