-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
100 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,80 @@ | ||
#!/bin/bash | ||
|
||
function is_django_installed() { | ||
python -c "import django" &>/dev/null | ||
} | ||
|
||
function should_collectstatic() { | ||
is_django_installed && [[ -z "$DISABLE_COLLECTSTATIC" ]] | ||
} | ||
|
||
# Install pipenv to the separate virtualenv to isolate it | ||
# from system Python packages and packages in the main | ||
# virtualenv. Executable is simlinked into ~/.local/bin | ||
# to be accessible. This approach is inspired by pipsi | ||
# (pip script installer). | ||
function install_pipenv() { | ||
echo "---> Installing pipenv packaging tool ..." | ||
VENV_DIR=$HOME/.local/venvs/pipenv | ||
virtualenv $VENV_DIR | ||
$VENV_DIR/bin/pip --isolated install -U pipenv | ||
mkdir -p $HOME/.local/bin | ||
ln -s $VENV_DIR/bin/pipenv $HOME/.local/bin/pipenv | ||
} | ||
|
||
set -e | ||
|
||
shopt -s dotglob | ||
echo "---> Installing application source ..." | ||
mv /tmp/src/* ./ | ||
|
||
if [[ ! -z "$UPGRADE_PIP_TO_LATEST" || ! -z "$ENABLE_PIPENV" ]]; then | ||
echo "---> Upgrading pip to latest version ..." | ||
pip install -U pip setuptools wheel | ||
fi | ||
|
||
if [[ ! -z "$ENABLE_PIPENV" ]]; then | ||
install_pipenv | ||
echo "---> Installing dependencies via pipenv ..." | ||
if [[ -f Pipfile ]]; then | ||
pipenv install --deploy | ||
elif [[ -f requirements.txt ]]; then | ||
pipenv install -r requirements.txt | ||
fi | ||
pipenv check | ||
elif [[ -f requirements.txt ]]; then | ||
echo "---> Installing dependencies ..." | ||
pip install -r requirements.txt | ||
elif [[ -f setup.py ]]; then | ||
echo "---> Installing application ..." | ||
python setup.py develop | ||
fi | ||
|
||
if should_collectstatic; then | ||
( | ||
echo "---> Collecting Django static files ..." | ||
|
||
|
||
APP_HOME=${APP_HOME:-.} | ||
# Look for 'manage.py' in the directory specified by APP_HOME, or the current directory | ||
manage_file=$APP_HOME/manage.py | ||
|
||
if [[ ! -f "$manage_file" ]]; then | ||
echo "WARNING: seems that you're using Django, but we could not find a 'manage.py' file." | ||
echo "'manage.py collectstatic' ignored." | ||
exit | ||
fi | ||
|
||
if ! python $manage_file collectstatic --dry-run --noinput; then | ||
echo "WARNING: could not run 'manage.py collectstatic'. To debug, run:" | ||
echo " $ python $manage_file collectstatic --noinput" | ||
echo "Ignore this warning if you're not serving static files with Django." | ||
exit | ||
fi | ||
|
||
pip install --upgrade pip | ||
pip install --upgrade setuptools | ||
pip install -r requirements.txt | ||
python $manage_file collectstatic --noinput | ||
) | ||
fi | ||
|
||
#python manage.py migrate --noinput | ||
# set permissions for any installed artifacts | ||
fix-permissions /opt/app-root |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
exec uwsgi --ini uwsgi.ini --module prs2.wsgi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[uwsgi] | ||
# Sensible defaults for an uWSGI application | ||
processes = 4 | ||
max-requests = 100 | ||
cache2 = name=default,bitmap=1,items=10000,blocksize=1000,blocks=200000 | ||
vacuum = true | ||
logdate = %%Y/%%m/%%d %%H:%%M:%%S | ||
|
||
# Process-related settings | ||
master = true | ||
http-socket = :8080 | ||
die-on-term = true | ||
touch-reload = uwsgi.ini | ||
|
||
# Django static files | ||
static-map = /static=staticfiles | ||
|
||
# Media uploads | ||
static-map = /media=media |