diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2020-05-26 02:21:03 +0100 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2020-05-26 02:21:03 +0100 |
commit | f4099c69292d3bff272cc1c8c3275b368ae1801b (patch) | |
tree | 2058a7503847dbb3085f22a27935d7e7e0034e22 /databaseReset.py | |
parent | 6ae5c0d912dfa9cfbf7dea8af2440b6bc8872bdd (diff) | |
download | troggle-f4099c69292d3bff272cc1c8c3275b368ae1801b.tar.gz troggle-f4099c69292d3bff272cc1c8c3275b368ae1801b.tar.bz2 troggle-f4099c69292d3bff272cc1c8c3275b368ae1801b.zip |
fix py3 bug and make settings import clearer
Diffstat (limited to 'databaseReset.py')
-rw-r--r-- | databaseReset.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/databaseReset.py b/databaseReset.py index 09b3214..81a3ad5 100644 --- a/databaseReset.py +++ b/databaseReset.py @@ -100,7 +100,7 @@ def import_surveyimgs(): for future re-working to manage progress against notes, plans and elevs. """ #import troggle.parsers.surveys - #print("Importing survey images") + print("NOT Importing survey images") #troggle.parsers.surveys.parseSurveys(logfile=settings.LOGFILE) def import_surveyscans(): @@ -258,7 +258,7 @@ class JobQueue(): print("-- ", settings.DATABASES['default']['NAME'], settings.DATABASES['default']['ENGINE']) - print("-- DATABASES.default", settings.DATABASES['default']) + #print("-- DATABASES.default", settings.DATABASES['default']) # but because the user may be expecting to add this to a db with lots of tables already there, # the jobqueue may not start from scratch so we need to initialise the db properly first @@ -334,7 +334,11 @@ class JobQueue(): print(" this", end=' ') else: # prints one place to the left of where you expect - days = (r[i]-r[len(r)-1])/(24*60*60) + if r[len(r)-1]: + s = r[i]-r[len(r)-1] + else: + s = 0 + days = (s)/(24*60*60) print('%8.2f' % days, end=' ') elif r[i]: print('%8.1f' % r[i], end=' ') @@ -388,6 +392,10 @@ if __name__ == "__main__": import django django.setup() + if os.geteuid() == 0: + print("Do not run as root or using sudo - file permissions for cache files and logs will break") + print("Aborting run.") + exit() if len(sys.argv)>2: runlabel = sys.argv[len(sys.argv)-1] else: @@ -452,7 +460,7 @@ if __name__ == "__main__": exit() else: usage() - print(("%s not recognised as a command." % sys.argv[1])) + print("%s not recognised as a command." % sys.argv[1]) exit() jq.run() |