From 674dae2b5518c959b7a37d3d4c9c989704818c56 Mon Sep 17 00:00:00 2001 From: Nikolay Zamotaev Date: Wed, 15 May 2019 20:20:43 +0300 Subject: Cleanup of documentation issues Task-number: AUTOSUITE-933 Change-Id: I492d7abbf5462b6d922b8ae319902375d23041ee Reviewed-by: Kavindra Palaraja --- doc/src/deployment-server.qdoc | 27 ++++++++++++++++++++++++++- manage.py | 1 + store/utilities.py | 10 +++++----- 3 files changed, 32 insertions(+), 6 deletions(-) mode change 100644 => 100755 manage.py diff --git a/doc/src/deployment-server.qdoc b/doc/src/deployment-server.qdoc index c6b2c45..3c5000d 100644 --- a/doc/src/deployment-server.qdoc +++ b/doc/src/deployment-server.qdoc @@ -102,7 +102,7 @@ \c{libffi-dev} package. Next, prepare the virtual environment: \code - virtualenv ./venv + virtualenv -p python2.7 ./venv ./venv/bin/pip install -r requirements.txt \endcode @@ -117,6 +117,31 @@ ./manage.py expire-downloads \endcode + \section2 Activate the Python Virtual Environment + + Before you run \c manage.py, source the activation script on the console where you will be using it. + + \code + . ./venv/bin/activate + \endcode + + This activation is done once per session only: + + + \section2 Prepare Your Databases on the Server + + Before you run the server, first, you must prepare the databases. Also, you need to create an administrative user. + + \code + ./manage.py makemigrations + ./manage.py migrate + ./manage.py createsuperuser + \endcode + + Make sure that the server has a user added for Neptune 3 UI's Downloads App. Currently the username and + password are hardcoded in \c apps/com.pelagicore.downloads/stores/ServerConfig.qml:78. + + \section2 Start the Server To start the server, run the following command in your terminal: diff --git a/manage.py b/manage.py old mode 100644 new mode 100755 index ad7604e..af588f4 --- a/manage.py +++ b/manage.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python2.7 ############################################################################# ## ## Copyright (C) 2019 Luxoft Sweden AB diff --git a/store/utilities.py b/store/utilities.py index 8a72661..611579c 100644 --- a/store/utilities.py +++ b/store/utilities.py @@ -91,7 +91,7 @@ def downloadPath(): return settings.MEDIA_ROOT + 'downloads/' -def isValidDnsName(dnsName, errorString): +def isValidDnsName(dnsName, errorList): # see also in AM: src/common-lib/utilities.cpp / isValidDnsName() try: @@ -106,7 +106,7 @@ def isValidDnsName(dnsName, errorString): labels = dnsName.split('.') if len(labels) < 3: - raise Exception('wrong format - needs to consist of at least three parts separated by .') + raise Exception('wrong format - needs to be in reverse-DNS notation and consist of at least three parts separated by .') # standard domain name requirements from the RFCs 1035 and 1123 @@ -125,7 +125,7 @@ def isValidDnsName(dnsName, errorString): return True except Exception as error: - errorString = str(error) + errorList[0] = str(error) return False @@ -353,9 +353,9 @@ def parseAndValidatePackageMetadata(packageFile, certificates = []): if pkgdata['header']['applicationId'] != pkgdata['info']['id']: raise Exception('the id fields in --PACKAGE-HEADER-- and info.yaml are different: %s vs. %s' % (pkgdata['header']['applicationId'], pkgdata['info']['id'])) - error = '' + error = [''] if not isValidDnsName(pkgdata['info']['id'], error): - raise Exception('invalid id: %s' % error) + raise Exception('invalid id: %s' % error[0]) if pkgdata['header']['diskSpaceUsed'] <= 0: raise Exception('the diskSpaceUsed field in --PACKAGE-HEADER-- is not > 0, but %d' % pkgdata['header']['diskSpaceUsed']) -- cgit v1.2.3