Skip to content
This repository has been archived by the owner on May 15, 2019. It is now read-only.

Commit

Permalink
Improve LDAP_URL parsing and Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
mpapillon committed Aug 9, 2017
1 parent 6f22280 commit 0c90b16
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 380 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

FROM python:3.6

LABEL maintainer "maxence.papillon@outlook.com"
LABEL maintainer=maxence.papillon@outlook.com

# set static and media directories to use
ENV APP_PATH=/usr/src/app
Expand All @@ -30,7 +30,7 @@ ENV DJANGO_SETTINGS_MODULE=teamlogger.settings.production
WORKDIR /usr/src/app

# get requirements
COPY requirements_prod.txt ./
COPY requirements_prod.txt requirements.txt ./
RUN pip install --no-cache-dir -r requirements_prod.txt

# copy all files into container
Expand Down
15 changes: 15 additions & 0 deletions docker-start-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'

catch_error() {
if [ $1 -gt 0 ]; then
echo "${RED}==>${NC} ${2}";
exit 1
fi
}

if [ -z ${APP_SECRET+x} ]; then
echo "${RED}==>${NC} The variable APP_SECRET is required.";
echo " Please, set a secret key and restart the container."
Expand All @@ -28,10 +35,18 @@ fi
# Database migration/creation
echo "${GREEN}==>${NC} Database migration"
python manage.py migrate
RETURN_CODE=$?

catch_error ${RETURN_CODE} "An error occurred during database migration.";

# Moving static files
echo "\n${GREEN}==>${NC} Collecting static files"
python manage.py collectstatic --clear --no-input -i *.less -i *.scss -i node_modules
RETURN_CODE=$?

catch_error ${RETURN_CODE} "An error occurred during the collect static command.";

echo "\n${GREEN}==>${NC} Stating the server"
gunicorn teamlogger.wsgi -b :8000 --log-file -

exit 0
2 changes: 1 addition & 1 deletion ldapab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from ldapab.core import LDAPConnectionHandler

__version_info__ = ('0', '1', '0', 'dev4')
__version_info__ = ('0', '1', '0')
__version__ = ".".join(__version_info__)

connections = LDAPConnectionHandler()
4 changes: 2 additions & 2 deletions ldapab/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ def directories(self):
self._servers = getattr(settings, 'LDAP_SERVERS', {})

# If no default settings, checking in environment variables
if DEFAULT_DIRECTORY_ALIAS not in self._servers and os.getenv('LDAP_URL'):
self._servers[DEFAULT_DIRECTORY_ALIAS] = parse_ldap_url(os.getenv('LDAP_URL'))
if os.getenv('LDAP_URL'):
self._servers[DEFAULT_DIRECTORY_ALIAS].update(parse_ldap_url(os.getenv('LDAP_URL')))

return self._servers

Expand Down
2 changes: 1 addition & 1 deletion nouvelles/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.


__version_info__ = ('0', '3', '0', 'dev8')
__version_info__ = ('0', '3', '0')
__version__ = ".".join(__version_info__)

__author__ = "Maxence PAPILLON"
Expand Down
2 changes: 1 addition & 1 deletion nouvelles/templates/nouvelles/article_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ <h2 class="title-plain">{{ title }}</h2>
<div class="panel-body">
<div id="editor" class="tab-editor tab-content active">
{{ form.content }}
<p class="help-text">You can use <a href="#md-sheet-cheat">Markdown syntax</a>.</p>
<p class="help-text">You can use Markdown syntax.</p>
</div>
<div id="preview" class="tab-content">
<div id="md_preview" class="highlight">
Expand Down
Loading

0 comments on commit 0c90b16

Please sign in to comment.