From 3f47a996b6183af6e086e37ea4eaaf0a9e0d7fe8 Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Thu, 1 Oct 2015 20:14:32 +0000 Subject: [PATCH] Fixes on deployment --- TODO.md | 22 +------------------ orchestra/bin/orchestra-admin | 10 +++++---- orchestra/conf/project_template/manage.py | 10 +++++---- .../management/commands/setuppostgres.py | 4 ++-- scripts/containers/deploy.sh | 2 +- 5 files changed, 16 insertions(+), 32 deletions(-) diff --git a/TODO.md b/TODO.md index 3a595a94..a4f19153 100644 --- a/TODO.md +++ b/TODO.md @@ -390,18 +390,12 @@ Case deploy --dev deploy.sh and deploy-dev.sh autoupgrade -orchestra home autocomplete skeleton short URLS: https://github.com/rsvp/gitio link backend help text variables to settings/#var_name - $ sudo python manage.py startservices -Traceback (most recent call last): - File "manage.py", line 8, in - from django.core.management import execute_from_command_line -ImportError: No module named django.core.management - +make python3 default python on the fucking docker container autocomplete; on the form header and type="search" To latest developers to post on this thread: I implemented the workaround I described in comment #14 nearly three months ago, and it has worked perfectly since then. While we would all prefer that "autocomplete=off" function properly at all times, it still functions properly if you include in your form an input element with any other autocomplete value. @@ -419,17 +413,3 @@ http://makandracards.com/makandra/24933-chrome-34+-firefox-38+-ie11+-ignore-auto mkhomedir_helper or create ssh homes with bash.rc and such - - $ sudo python3 manage.py setupnginx --user orchestra -/usr/lib/python3.4/importlib/_bootstrap.py:321: RemovedInDjango19Warning: django.utils.importlib will be removed in Django 1.9. - return f(*args, **kwds) - -/usr/local/lib/python3.4/dist-packages/django/contrib/contenttypes/models.py:159: RemovedInDjango19Warning: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS or else was imported before its application was loaded. This will no longer be supported in Django 1.9. - class ContentType(models.Model): - -/usr/lib/python3.4/importlib/_bootstrap.py:321: RemovedInDjango19Warning: The django.forms.util module has been renamed. Use django.forms.utils instead. - return f(*args, **kwds) - -/usr/lib/python3.4/importlib/_bootstrap.py:321: RemovedInDjango19Warning: The utilities in django.db.models.loading are deprecated in favor of the new application loading system. - return f(*args, **kwds) - diff --git a/orchestra/bin/orchestra-admin b/orchestra/bin/orchestra-admin index 90d5b967..bbcf2b6f 100755 --- a/orchestra/bin/orchestra-admin +++ b/orchestra/bin/orchestra-admin @@ -124,7 +124,7 @@ function install_requirements () { libcrack2-dev" # cracklib and lxml are excluded on the requirements.txt because they need unconvinient system dependencies - PIP="$(wget https://raw.githubusercontent.com/glic3rinu/django-orchestra/master/requirements.txt -q -O - | tr '\n' ' ') \ + PIP="$(curl https://raw.githubusercontent.com/glic3rinu/django-orchestra/master/requirements.txt | tr '\n' ' ') \ cracklib \ lxml==3.3.5" @@ -147,9 +147,11 @@ function install_requirements () { fi # Install a more recent version of wkhtmltopdf (0.12.2) (PDF page number support) - wkhtmltox=$(mktemp) - wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-jessie-amd64.deb -O ${wkhtmltox} - dpkg -i ${wkhtmltox} || { echo "Installing missing dependencies for wkhtmltox..." && apt-get -f -y install; } + if [[ $(dpkg --list | grep wkhtmltox | awk {'print $3'}) != "0.12.2.1" ]]; then + wkhtmltox=$(mktemp) + wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-jessie-amd64.deb -O ${wkhtmltox} + dpkg -i ${wkhtmltox} || { echo "Installing missing dependencies for wkhtmltox..." && apt-get -f -y install; } + fi # Make sure locales are in place before installing postgres if [[ $({ perl --help > /dev/null; } 2>&1|grep 'locale failed') ]]; then diff --git a/orchestra/conf/project_template/manage.py b/orchestra/conf/project_template/manage.py index c87fc51f..e0bfc980 100755 --- a/orchestra/conf/project_template/manage.py +++ b/orchestra/conf/project_template/manage.py @@ -1,11 +1,13 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os import sys + if __name__ == "__main__": + if sys.version_info < (3, 4): + cmd = ' '.join(sys.argv) + sys.stderr.write("Sorry, you need at least Python 3.4, try with:\n$ python3 %s\n" % cmd) + sys.exit(1) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings") - from django.core.management import execute_from_command_line - execute_from_command_line(sys.argv) - diff --git a/orchestra/management/commands/setuppostgres.py b/orchestra/management/commands/setuppostgres.py index ae177c5c..176915d4 100644 --- a/orchestra/management/commands/setuppostgres.py +++ b/orchestra/management/commands/setuppostgres.py @@ -60,8 +60,8 @@ class Command(BaseCommand): sed -i "s/'NAME':[^#]*/'NAME': '%(db_name)s',/" %(settings)s sed -i "s/'USER':[^#]*/'USER': '%(db_user)s',/" %(settings)s sed -i "s/'PASSWORD':[^#]*/'PASSWORD': '%(db_password)s',/" %(settings)s - sed -i "s/'HOST': [^#]*/'HOST': '%(db_host)s',/" %(settings)s - sed -i "s/'PORT': [^#]*/'PORT': '%(db_port)s',/" %(settings)s\ + sed -i "s/'HOST':[^#]*/'HOST': '%(db_host)s',/" %(settings)s + sed -i "s/'PORT':[^#]*/'PORT': '%(db_port)s',/" %(settings)s\ """) % context ) else: diff --git a/scripts/containers/deploy.sh b/scripts/containers/deploy.sh index 041f40fb..298816a4 100644 --- a/scripts/containers/deploy.sh +++ b/scripts/containers/deploy.sh @@ -79,7 +79,7 @@ function main () { run python3 -W ignore manage.py collectstatic --noinput run sudo apt-get install nginx-full uwsgi uwsgi-plugin-python3 run sudo python3 -W ignore manage.py setupnginx --user $USER - run sudo python3 -W ignore manage.py startservices + run sudo python3 -W ignore manage.py restartservices run python3 -W ignore manage.py check --deploy }